Re: [csswg-drafts] [selectors][css-scoping] Should `:host:has()` match? (#10693)

I think it should match in both cases, just like the logical combination pseudos. The reason the host is featureless is because you can't control the markup of the host element, and so it's easy to write a selector you expect to only match the markup you control (in the shadow) and have it accidentally match the host element due to the outer page doing things you can't predict.

This doesn't apply to `:has()` - it's matching based on markup you *do* control (in the shadow), and thus is completely predictable. Even if you use a complex selector in the `:has()` argument, because it's matching inside the shadow and uses that matching context, it can't match the host element unexpectedly.

The only way to get an unexpected match is if you just forget the host element exists at all (because you generally don't pay attention to it), but that's a brain fart, not an unpredictable situation. I think that's okay. In particular, writing an *unqualified `:has()`* seems like a weird thing to do in the first place, which is the only way it would match the host without actually mentioning `:host`.

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


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

Received on Tuesday, 6 August 2024 17:37:28 UTC