Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show style applied on tag (p, span, div) and private selectors as parent rules instead of hiding them #5890
Show style applied on tag (p, span, div) and private selectors as parent rules instead of hiding them #5890
Changes from 3 commits
52ba783
12b0452
848fbca
9f6289c
26ee377
3ee8d71
d2adb8b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not to simply check
rule.selectorsToString() === tagName
?The logic here will take wrong rules, eg.
.something DIV .something-else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot just check
rule.selectorsToString() === tagName
becausetagName
only include the tag name likediv
,section
,li
... and not all the path likerule.selectorsToString()
can have (.something .something-else div
).In fact, it's a problem for this case:
.something DIV .something-else
. So I add a check to be sure the tagName is the last element in therule.selectorsToString()
.I know this function is not perfect, it still contains this caveat:
In the previous case,
.cls1 div
will be return as a rule for both div because I don't how to check a component is a child or not of a component having.cls1
. Or if we can check that I think we will add a lot of loops...I don't know what is the best things to do:
1 - Know the caveat and let it like this
2 - Try to fix it and add a lot of checks and loops
In every case, I fix the following case
.something DIV .something-else
and add a test on it :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest to keep it simple for now, only selectors with one and single tagName are accepted, eg.
div
is ok,.cls1 div
is not. So let's just dorule.selectorsToString() === tagName
.You're not considering a lot of CSS selectors, like in your case
.cls2 div
will be taken as valid, also.cls2 div div
... it's better to skip those rules instead of showing the wrong ones.We won't be able to be precise with the current approach anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did what you say. So it's only working for single tag name. It simplify the code too so it's a good thing !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 0.17 version is supported.