-
Notifications
You must be signed in to change notification settings - Fork 674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-selectors] new pseudo class that matches shadow hosts #2908
Comments
Would this only be needed in the |
(I editted your comment to refer to the static profile that you meant.) We only have the static profile for things that are problematic for perf reasons to be live. I want to absolutely minimize what goes in there; it's very confusing for authors to be able to use something in qSA() but not in stylesheets. Even if we don't know of any use-cases for this in a normal stylesheet, keeping the language consistent is important for usability. Anyway, I support this proposal, seems reasonable. |
Possible use-case for this in CSS: being able to add a style only to the web components on the page, either as a means of debugging or passing down specific styles. |
How would we expect something like this to work with an element that has a shadow root as applied by the user agent? Similarly, would we expect this pseudo class to work differently between open and closed shadow roots? Is a user agent shadow root technically closed, anyways? I do like the idea that it supports better collection of elements with shadow roots. Having this capability also make me feel like there's some glimmer of a possibility that 3rd party tools (Hotjar style analytics, ARC toolkit style extensions, etc.) would be more eager to expand their coverage to sites that leverage shadow DOM by reducing the tree walking needed to activate their features in that context. |
We would like to propose a new
:has-shadow
pseudo class that matches an element with open shadow root attached. The name is tentative and I am open to discussion for any alternatives.The expected use cases are mostly for searching shadow host element, to run
querySelector
recursively, as we lost>>>
combinator. For styling purpose,:host
and:host()
, or custom element default style satisfy most of the needs, I believe.See also whatwg/dom#665 for more context.
The text was updated successfully, but these errors were encountered: