[csswg-drafts] [css-scoping][selectors] Should :where(:host) work? (#6420)

LeaVerou has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-scoping][selectors] Should :where(:host) work? ==
Currently, the root of a web component can only be selected via `:host` and its varieties (`:host()`, `:host-context()` etc). [[spec](https://drafts.csswg.org/css-scoping/#host-element-in-tree)]

Because `:host` has a specificity of `0,1,0`, it can interfere with UA styles, such as those that set `[hidden] { display: none }`. For that reason, [authors are instructed to explicitly account for that in every web component they write](https://developers.google.com/web/fundamentals/web-components/best-practices#add-a-:host-display-style-that-respects-the-hidden-attribute.) which is IMO untenable in the long run.

The whole point of [`:where()`](https://drafts.csswg.org/selectors/#zero-matches) is to rectify that kind of problem, however `:where(:host)` does not currently work. Is there a way to fix that? 

cc @tabatkins 

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6420 using your GitHub account


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

Received on Saturday, 3 July 2021 12:37:43 UTC