Re: [csswg-drafts] [selectors-4] [css-nesting-1] pseudo elements need to be clarified to correctly handle relative selectors. (#7979)

If the relative selector `::before` should be treated as `*::before`, then `:has(::before)` should be treated as `:has(*::before)` (and analogous for all pseudo-elements). But #7463 resolved:

> allow future pseudo-elements to define that they are valid if useful/possible.

And the most common usecase seems to check if the element itself has the pseudo-element (and not some random descendant).
So the only options seem:
 1. Let `&` or `:scope` inside `:has()` refer to the anchor element. This increases invalidation complexity and then it's difficult to implement (#7211)
 2. Add `:>` as a pseudo-element combinator (#7346)
 3. Let `::before` and `*::before` have different meanings in relative selectors.

1 and 2 are hypothetical so I'm assuming 3. Thus `::before` and `*::before` can also have different meanings in nesting.

Should they? I dunno, I don't use Sass either, so allowing relative nested selectors that don't start with an explicit combinator is completely confusing to me.

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


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

Received on Wednesday, 2 November 2022 21:47:16 UTC