Re: [csswg-drafts] [selectors] Is it intentional that :has(:is()) is different from :has()? (#9422)

Ohhhh, I glossed right over the fact that the inner `@scope` was just holding raw properties. Sorry, it is indeed equivalent to the `&` desugaring in your first block.

But your second desugaring isn't at all correct. First, the `#middle` is nested relative to the outer rule, so it's effectively `:is(#outer #inner) #middle` (aka just `#outer #inner #middle`). Then the `&` matches the elements matched by the scoping root, so it's *also* effectively `#outer #inner #middle`.

It looks like you're assuming the `&` "skips past" the `@scope` rule and is relative to the nearest "normal" style rule, but that's not the case. This is defined by <https://drafts.csswg.org/css-nesting/#nesting-at-scope> (and a little bit by <https://drafts.csswg.org/css-cascade-6/#scoped-rules>).

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


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

Received on Thursday, 28 September 2023 23:45:32 UTC