Re: [csswg-drafts] [selectors-4] Add :has() to the list of logical combination pseudo-classes (#10749)

> I think pseudo-elements cannot be followed by `:has()`.
> 
> > This specification allows any pseudo-element to be followed by any combination of the logical combination pseudo-classes and the user action pseudo-classes.

Good point, this is an unintended consequence of the proposed edit I hadn't realized. `::first-line:has(...)` seems like a reasonable thing to express but could lead to dependency cycles so I don't think we want to allow it. And I don't see how `::before`, `::after`, or `::first-letter` could possibly match `:has()`, so there's no reason to allow those either.

> There is probably a good reason for `:has()` to be in the "Logical Combinations" section but I see it as a tree-structural pseudo-class.

I can see both sides of this. On one hand, because `:has()` takes a `<relative-selector-list>` there's an implied OR between the selectors in that list. On the other hand, unlike `:is()`, `:where()` and `:not()`, `:has()` requires examining the tree beyond the subject of the selector. @tabatkins / @fantasai wdyt?

-- 
GitHub Notification of comment by kbabbitt
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/pull/10749#issuecomment-2305400082 using your GitHub account


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

Received on Thursday, 22 August 2024 18:35:57 UTC