Re: [csswg-drafts] [selectors] Should :not(foo) match the host of the shadow tree? (#10179)

This has some pitfalls, though: The mere presence of :host would influence the rest of the selector. We probably don't want this situation:

* `:not(.foo)`: false (no :host in selector, so not considered for match)
* `:not(:host)`: false (:host in selector, so considered for match, but the selector itself does not match)
* `:is(:not(.foo), :not(:host))`: true!

Not to mention the forward-compat issues we had with nesting, where people were worried about what would happen if something unknown to the browser (from a future spec) was nest-containing. You have a similar problem here with “host-containing”.

TBH I'm not too worried about performance here; it's just one more element to match in a potentially very long chain, and if you want to optimize that out by checking for `:host`, you can just as easily drop the optimization if there's a `:not` in there (which is fairly rare).

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


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

Received on Tuesday, 9 April 2024 12:33:38 UTC