Re: [csswg-drafts] [css-cascade-6] Scoped selectors shouldn't match the scope root unless explicitly requested with :scope? (#8377)

Digging into this, I'm convinced that authors will expect 'nested by default' behavior - which would better match how nesting works as well. To get there, we don't actually want to _remove_ the scope root from the scope. We only want to imply that the scoped element is prepended as an ancestor, unless otherwise explicitly placed in a selector. This would bring `:scope` and `&` more fully in line. Both already have the same specificity, and the same is-like parent-element matching logic already. 

This is a bit different from the ['virtual' scoping root behavior defined for dom fragments](https://w3c.github.io/csswg-drafts/selectors/#scope-pseudo), the primary use of `:scope` currently. According to the spec, document fragment roots can be mentioned in a scoped selector, but can't be the subject of the selector. If we have to match that behavior, I think it would be too restrictive.

If we go that rout, it's not an exact parallel with `:boundary` or `:scope-end`. On the root side, we're defining an implied ancestor/descendant relationship between selectors. On the lower boundary, we would have an element that is fully _out of scope_ for some selectors, and fully _in scope_ for other selectors. That might also be useful, but it would need a different mechanism for describing the behavior. 

-- 
GitHub Notification of comment by mirisuzanne
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8377#issuecomment-1430493760 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 14 February 2023 22:48:16 UTC