Nested rules are styled as unmatched
Categories
(DevTools :: Inspector: Rules, defect, P1)
Tracking
(firefox116 fixed)
Tracking | Status | |
---|---|---|
firefox116 | --- | fixed |
People
(Reporter: nchevobbe, Assigned: nchevobbe)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
If you have the following
body {
& main {
…
}
}
The rule have the unmatched style (e.g. the selector as a lighter gray)
It looks like this is because we're using the rule selector directly (& main
), but &
can't be used to query an element, we need to substitute it with the parent selector (and if the parent selector also has &
, we need to substitute it with its parent selector as well, and so on)
From the spec (https://www.w3.org/TR/css-nesting-1/#nest-selector) :
The nesting selector can be desugared by replacing it with the parent style rule’s selector, wrapped in an
:is()
selector.
So for our case, & main
should be turned into :is(body) main
(this may be resolved at the same time as Bug 1838163, since the issue does look similar, but let's have different bugs to add specific tests)
Assignee | ||
Comment 1•1 year ago
|
||
Julian encountered a similar issue:
I only found one STR which confuses a bit the rule view:
- open https://bug1836873-css-nesting-example.glitch.me/
- inspect the innermost square
- edit the
& > .awesome
selector so that it no longer matches (eg& > .awesom
)- revert the selector so that it matches
ER: The selector should be updated to full opacity, AR: The selector still looks as if it is not matching
Let's check it again once we have the basic case covered
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Comment 2•1 year ago
|
||
Return the desugared selectors from getMatchedSelectors
, and use the desugared
selector we have on the rule to match against those.
A test case with nested rule is added to ensure the issue is properly fixed.
Depends on D181732
Updated•1 year ago
|
Comment 4•1 year ago
|
||
bugherder |
Description
•