Re: [csswg-drafts] [css-cascade-6] Scoping the subject of a `:has()` selector (#9841)

In https://github.com/w3c/csswg-drafts/issues/9740 it was brought up that there is a similar case, where you could have something like `.foo :scope .bar`, or, likely more often, `:scope .bar:is(.foo *)`, where we'd want to clarify that this `.foo` should be “in scope”.

I propose to introduce something like a `:in-scope` pseudo-class, which could be then used with any selectors, and will only match for elements that are inside the current scope.

The example from the OP will be then

```CSS
@scope (my-scope) to (my-scope) {
  :scope:has(a:in-scope) { … }
}
```

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


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

Received on Thursday, 3 July 2025 11:36:53 UTC