[csswg-drafts] [css-scoping] `:has-shadow` pseudo-class (#11007)

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

== [css-scoping] `:has-shadow` pseudo-class ==
It is currently *impossible* to detect elements with a shadow root without direct traversal and checking `element.shadowRoot` for every single element, which is costly.

This is useful for a variety of DOM traversal use cases, so they can identify which elements they need to do extra work on. For example fetching elements of a particular type across the entire flattened tree, or even cloning a subtree that may contain declarative shadow roots (which disappear).

It’s probably pretty easy to add a pseudo-class for this that matches if the element has an open shadow root. Not sure if matching a closed shadow root is desirable.

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


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

Received on Monday, 7 October 2024 05:16:32 UTC