[csswg-drafts] Consider making `:slotted(...)` a pseudo class (#7305)

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

== Consider making `:slotted(...)` a pseudo class ==
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.

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


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

Received on Wednesday, 25 May 2022 01:53:21 UTC