Re: [csswg-drafts] Mixing :is() (or equivalent) with pseudo-elements (#9702)

> When you have `:is(...)`, that is implicitly equal to `*:is(...)`.

Thanks, that's the part I missed. It makes sense.

> Thinking on this a bit, I suppose another possibility would be to slightly change the Selectors data model, such that all the "hidden" elements _are_ in the match set before each compound selector is applied, but they're _post-filtered_ out of the match set if they weren't explicitly matched by something in the compound selector, before the next combinator is applied.

Yeah, I somehow thought it _already_ kind of worked like this.

> That is, `*` would select all elements _and pseudo-elements_ on the page, but unless a `::foo` is in the `<complex-selector-unit>`, the pseudo-elements are removed from the final match result. That would allow `*:is(.foo, .foo::before)` to work (matching both `.foo` elements and their `::before` pseudos), while still preventing `.foo:is(*, ::before)` from working (it would only match `.foo` elements, as the `::before`s wouldn't match the `.foo` simple selector).
> 
> I wanna sit with this one a bit, but I think it might actually solve our problems generally, for both `:is()` and Nesting, without actually needing any new syntax at all?

I think this is the way to go.


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


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

Received on Wednesday, 3 September 2025 11:49:25 UTC