Re: [csswg-drafts] [css-nesting][selectors] Behavior of & at the root of a stylesheet (#10287)

For me the "root specificity exception" (i.e. that root-level `&` targeting `:scope` has zero selector specificity, like in current Firefox and Chrome) makes also sense, but I understand that it seems like an extra hatch maybe.

Intuitively I'd expect that when I fold everything I have so far in a style with one or more `&`s it should not change "much", i.e. in.
```HTML
<style>
& { & { body { --prop: 3; } } }
& { body { --prop: 2; } }
body { --prop: 1; }
</style>
```
I'd expect to `--prop` to be still `1`.

I see that it might be inconsistent with non-root `&` behaviour and explicit `:where`s would be required here to make it weak again, thus uniform with `&`'s general behaviour. I guess in
```HTML
<style>
:where(&) { :where(&) { body { --prop: 3; } } }
:where(&) { body { --prop: 2; } }
body { --prop: 1; }
</style>
```
`--prop` gets resolved to `1` even in Safari right now? (Cannot test.)

This also maybe raises a question for #8752 , whether `<el style="--prop: …;">` and `<el style="& { --prop:  …; }">` should make any difference or not.

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


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

Received on Monday, 13 May 2024 09:18:28 UTC