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
I'm having trouble finding prior discussion and I'm a noob and not a spec person, so apologies in advance.
::slotted(...) selects real elements within the same shadow tree as the selector, so it's unclear to me why it should be a pseudo element while e.g. :has(...)/:where(...)/:is(...)/:host(...)/:host-context(...) are all pseudo classes. One real world issue with this is that I can't querySelectorAll inside a shadow DOM for a ::slotted() selector, despite the selector targeting real elements by definition.
In contrast, ::part(...) being a pseudo element makes sense, since the element is essentially abstract from the point of view of the selector, since the actual element belongs to a different (shadow) tree.
There's probably some underlying reason here that I'm missing (and I would very much appreciate learning something new!) but otherwise this seems like it could be a nice low hanging improvement.
The text was updated successfully, but these errors were encountered:
devknoll
changed the title
Consider making :slotted(...) a pseudo class
[selectors] Consider making :slotted(...) a pseudo class
May 25, 2022
devknoll
changed the title
[selectors] Consider making :slotted(...) a pseudo class
[scoping] Consider making :slotted(...) a pseudo class
May 25, 2022
If I had to guess, it was done this way because technically you are selecting a slot element with the ::slotted pseudo element. The slot belongs to the tree with the style, but the slotted content doesn't. I guess this makes sense.
I'm having trouble finding prior discussion and I'm a noob and not a spec person, so apologies in advance.
::slotted(...)
selects real elements within the same shadow tree as the selector, so it's unclear to me why it should be a pseudo element while e.g.:has(...)
/:where(...)
/:is(...)
/:host(...)
/:host-context(...)
are all pseudo classes. One real world issue with this is that I can'tquerySelectorAll
inside a shadow DOM for a::slotted()
selector, despite the selector targeting real elements by definition.In contrast,
::part(...)
being a pseudo element makes sense, since the element is essentially abstract from the point of view of the selector, since the actual element belongs to a different (shadow) tree.There's probably some underlying reason here that I'm missing (and I would very much appreciate learning something new!) but otherwise this seems like it could be a nice low hanging improvement.
The text was updated successfully, but these errors were encountered: