Open
Description
Nest-prefixed: https://drafts.csswg.org/css-nesting/#nest-prefixed
Nest-containing: https://drafts.csswg.org/css-nesting/#nest-containing
These types of relative selectors are useful beyond nesting, as the ampersand can become a universal CSS this
equivalent. E.g. I can imagine a qSA-like JS API that allows us to do things like input.find("& + label")
or even compositions like find("&.foo", "& > .bar", ".baz")
, or even HTML attributes that allow us to refer to elements relative to the current element (how useful that would have been with label[for]
!)
Sure, there is also :scope
, but there’s a reason we didn't base nesting off that.