- From: Christoph Päper via GitHub <sysbot+gh@w3.org>
- Date: Mon, 18 Nov 2024 18:07:29 +0000
- To: public-css-archive@w3.org
Crissov has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-nesting][selectors] Specificity of `& {}` == https://drafts.csswg.org/css-nesting/#nest-selector https://drafts.csswg.org/selectors/#specificity > When used in any other context, [`&`] represents the same elements as [:scope](https://drafts.csswg.org/selectors-4/#scope-pseudo) in that context (unless otherwise defined). > The [nesting selector](https://drafts.csswg.org/css-nesting/#nesting-selector) can be desugared by replacing it with the parent style rule’s selector, wrapped in an [:is()](https://drafts.csswg.org/selectors-4/#matches-pseudo) selector. This means that `& {}` can be desugared into `:is(:scope) {}`. > The [specificity](https://drafts.csswg.org/selectors-4/#specificity) of the [nesting selector](https://drafts.csswg.org/css-nesting/#nesting-selector) is equal to the largest specificity among the complex selectors in the parent style rule’s selector list (identical to the behavior of [:is()](https://drafts.csswg.org/selectors-4/#matches-pseudo)), or zero if no such selector list exists. `:is(:scope) {}` would have specificity (0,1,0), i.e. the same as `:scope {}`, but `& {}` is explicitly defined as having a specificity of (0,0,0) because there is no parent style rule’s selector list. Since there is a collapsed explanation for the equivalency with `:is()` but there is no reasoning provided for this difference, is this truly intentional? Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11235 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 18 November 2024 18:07:29 UTC