You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently in all browsers, within a shadow root, a selector such as :host::part(something)will select parts within that same shadow root. I’m curious if this is intentional as I cannot tell from the spec that the non-functional :host pseudo-class can be a compound selector like this. Admittedly, this is a nicer API than using an attribute selector, so I am happy if that’s the case. Further, in Firefox, a selector like ::part(something) on its own within a shadow root can select parts within the same shadow root. This seems maybe a bit problematic since then it could select parts within two shadow roots at the same time (e.g. a nested shadow root as well).
This comment probably answers your question about compounding :host:
:host will only ever match anything if these hold:
:host appears in the leftmost compound selector.
:host is the only simple selector in that compound.
"For the purpose of Selectors, a shadow host also appears in its shadow tree, with the contents of the shadow tree treated as its children. (In other words, the shadow host is treated as replacing the shadow root node.)
edit: it answers your question, assuming:host::part(), :host::before, etc. are not real compound selectors but a combination of a compound selector and a pseudo-compound selector, as if :: were a combinator.
Uh oh!
There was an error while loading. Please reload this page.
Currently in all browsers, within a shadow root, a selector such as
:host::part(something)
will select parts within that same shadow root. I’m curious if this is intentional as I cannot tell from the spec that the non-functional:host
pseudo-class can be a compound selector like this. Admittedly, this is a nicer API than using an attribute selector, so I am happy if that’s the case. Further, in Firefox, a selector like::part(something)
on its own within a shadow root can select parts within the same shadow root. This seems maybe a bit problematic since then it could select parts within two shadow roots at the same time (e.g. a nested shadow root as well).Demo for each case mentioned
The text was updated successfully, but these errors were encountered: