W3C home > Mailing lists > Public > public-css-archive@w3.org > July 2021

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

From: Lea Verou via GitHub <sysbot+gh@w3.org>
Date: Sat, 03 Jul 2021 12:37:42 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-936246918-1625315860-sysbot+gh@w3.org>
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

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:38 UTC