Re: [csswg-drafts] [selectors-4] Should `:has()` be a complex selector? (#10756)

Yes, it should be complex and it should definitely match inside `:host(...)`. The `:has` selector has been an [incredibly](https://www.bram.us/2022/12/13/quantity-queries-for-islands-of-elements-with-the-same-class-thanks-to-css-has/) [useful](https://css-tricks.com/more-real-world-uses-for-has/) [addition](https://webkit.org/blog/13096/css-has-pseudo-class/) to css.

We [need](https://github.com/WICG/webcomponents/issues/1051) [less](https://github.com/WICG/webcomponents/issues/909), [not](https://github.com/WICG/webcomponents/issues/986) more styling restrictions for Shadow DOM styling.

Right now `:host(:has(...))` has different behavior in each major engine ([see example](https://lit.dev/playground/#gist=b64b2c4476aa61b70987a2660ea96454)):
* Chrome 128: does not match at all
* Firefox 129: matches simple selector, e.g. `:host(:has(div))`
* Safari 17.5: matches compound selector, e.g. `:host(:has(div div))`

What developers who actually use Shadow DOM beg for is Safari's behavior. Please clarify the spec to clearly support this.

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


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

Received on Monday, 26 August 2024 00:37:14 UTC