-
Notifications
You must be signed in to change notification settings - Fork 758
Description
When discussing #7922, I raised a concern that the current implementation of ::slotted (which matches selectors based on their light DOM relationships, regardless of slot assignments) could be compounded by adding combinator support inside that pseudo.
This codepen demonstrates the confusion of styling :first-child/:last-child when using named slots b/c the selector is evaluated based on the :first-child in the light DOM but not the :first-child as assigned to a named slot.
I propose we create a new approach to styling slotted content that allows authors to identify 'default' or named slot. i.e.,
::resolved-slot('one', *:first-child) {
^ Not in love with that naming but we can bikeshed later.
Alternatively, @LeaVerou mentioned a possible alternative syntax entirely to indicate a shift from the web component's Shadow DOM to the light DOM. Perhaps:
@slotted {
p:first-child { ... }
div + div { ... }
}
with a named slot:
@slotted (name="one"){
p:first-child { ... }
div + div { ... }
}