-
Notifications
You must be signed in to change notification settings - Fork 642
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-shadow-parts] match parts of the current shadow root #7955
Comments
+1 Makes total sense to me. This API would greatly simplify working with Shadow DOM parts. 👏🏼 |
Those two specificities don't compete because the style sheets are in separate trees, fwiw. |
:host::part(..) should work in Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=1624968) and it's a bug that it doesn't work in other browsers afaict. |
Though apparently other browsers also fixed it? |
Thank you, @emilio. If evergreen browser support for
Ah, thank you. Like |
Background: To match a shadow part from outside its own shadow root, we use the
::part()
pseudo-element selector.That selector will have a calculated specificity of 1 Type.
Issue: To match a shadow part from within its own shadow root, we use CSS attribute selector. It feels rather inelegant because of how dissimilar it is to the
::part()
selector.That selector will have a different calculated specificity; 2 Classes. To match the
::part()
specificity of 1 Type, we must add additional selector trickery.That selector feels very long, cryptic, and too dissimilar from its light
::part()
counterpart.Recommendation: May we add a
:host-part()
pseudo-class selector to match elements with the given parts?Edit: @Westbrook was kind enough to point out a far more readable fallback. It won’t match the suggested specificity, but it is far more readable.
The text was updated successfully, but these errors were encountered: