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

What I would expect, modulo specificity,

`.foo { &::before { &:hover{}}}` is `.foo::before:hover`
`.foo, ::before { &:hover {}}` is `.foo:hover, ::before:hover`
`.foo, ::before { :hover& {}}` is `.foo:hover, ::before:hover`
`.foo, ::before { &::marker {}}` is `.foo::marker, ::before::marker`
`.foo, ::before { ::marker& {}}` never matches
`.foo, ::marker { ::marker& {}}` is `::marker`

That is, `&` matches any element or pseudo-element matched by the parent selector.

And the problem with putting this into `:is()` seems that

- `::before:is(:hover)` should be `::before:hover` I think?
- `:hover { ::before& {}}` shouldn't match anything, because a top-level `:hover` can't match pseudo-elements.

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


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

Received on Friday, 14 November 2025 14:31:12 UTC