Re: [csswg-drafts] [selectors][css-nesting] Move nest-containing and nest-prefixed selector definitions to Selectors (#5745)

Discussing with @LeaVerou, @jensimmons, @bradkemper, @tabatkins, and @mirisuzanne today, we all agree that making & have meaning outside of nested context is a good idea, as it makes selectors containing these portable between nested context, regular context, and `@scope` contexts.

The definition would basically be, within nested context it refers to the nesting selector, and otherwise it's an alias for `:scope`. IIRC this expands to the following consequences:

- Within nested context, it refers to the nesting element
- Within `@scope` context, it refer to the scope root
- In shadow DOM style sheets it matches the shadow root element
- In .querySelector it matches the context element
- 
Open questions:
- Should it do anything special anywhere else, e.g. in `:has()`, which also takes relative selectors?
- If not, should `:scope` and `&` be syntactic aliases (i.e. make `:scope` expand out the same as `&` in nested contexts) or should they differ in some cases (nested selectors, or other cases)?

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


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

Received on Wednesday, 5 October 2022 19:20:04 UTC