Skip to content

[scoping] Consider making :slotted(...) a pseudo class #7305

Description

@devknoll

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions