- From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
- Date: Tue, 24 Jan 2023 21:08:40 +0000
- To: public-css-archive@w3.org
This syntax defines how style rules are nested into other style rules; calling the spec "Nesting" works just fine, and there's not really anything that it's ambiguous with. > What happens if I put :scope in a scope-start selector of a nested @scope? It matches one of the scoping elements from the nearest `@scope` (the outer one, since you're in the middle of defining the inner one). > What about in a scoped selector inside @scope? It matches one of the scoping elements from the nearest `@scope`. > These are not foreign concepts to either spec. Indeed they're not, `:scope` and `&` do essentially the same thing, and that's part of the issue - if we used `:scope` for both, and an author uses the two features together, they could only refer to one or the other. In particular, they wouldn't be able to use `@scope (.one) { .two { :scope.three * {...}}}` to style things where the scoping element has both `.one` and `.three`; their selector would instead be referring to a `.two.three` element *underneath* the scoping element, as the `:scope` refers to the intervening style rule rather than the scope rule. This is probably a minor loss, all in all (and you can't refer to grandparent nesting rules in Nesting, anyway), but a `@scope` rule *does* generally represent a more semantically meaningful container than a nesting rule does, so the chance that you'll want to refer to it is higher. So losing the ability to refer to it if you're additionally nesting would sting a little bit more. > I'm saying it already acts like one, so it probably should be defined in the shared language of one, so why is this not a route to take? Nesting does not act like a scoping container. It's very much normal to write nested rules that aren't *remotely* scoped to the outer rule, like `.foo { :not(&) {...}}`, not to mention using sibling combinators, etc. Nesting is a convenience feature for writing selectors that reuse other selectors, nothing more. -- GitHub Notification of comment by tabatkins Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8329#issuecomment-1402667446 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 24 January 2023 21:08:42 UTC