Skip to content

Add shadowrootslotassignment attribute#12267

Open
keithamus wants to merge 3 commits intowhatwg:mainfrom
keithamus:add-shadowrootslotassignment-attribute
Open

Add shadowrootslotassignment attribute#12267
keithamus wants to merge 3 commits intowhatwg:mainfrom
keithamus:add-shadowrootslotassignment-attribute

Conversation

@keithamus
Copy link
Member

@keithamus keithamus commented Mar 16, 2026

Implements the shadowrootslotassignment attribute.

Refs WICG/webcomponents#967

(See WHATWG Working Mode: Changes for more details.)


/indices.html ( diff )
/parsing.html ( diff )
/scripting.html ( diff )

@keithamus keithamus added agenda+ To be discussed at a triage meeting topic: custom elements Relates to custom elements (as defined in DOM and HTML) labels Mar 16, 2026
@keithamus
Copy link
Member Author

/cc @mfreed7

@rniwa
Copy link

rniwa commented Mar 16, 2026

It seems that we also need a mechanism to specify which nodes are assigned in what order.

@keithamus
Copy link
Member Author

It seems that we also need a mechanism to specify which nodes are assigned in what order.

Right. I think that it would be possible to ship the two independently, right? It's possible today to create a manual assignment shadowroot and never assign nodes.

@rniwa
Copy link

rniwa commented Mar 16, 2026

It seems that we also need a mechanism to specify which nodes are assigned in what order.

Right. I think that it would be possible to ship the two independently, right? It's possible today to create a manual assignment shadowroot and never assign nodes.

Maybe? It seems like we want some kind of plan for it before we this feature though.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to add the IDL attribute for the template element.

@mfreed7
Copy link
Collaborator

mfreed7 commented Mar 16, 2026

/cc @mfreed7

This looks great to me! I could finally address this 4 year old Chromium TODO.

Right. I think that it would be possible to ship the two independently, right? It's possible today to create a manual assignment shadowroot and never assign nodes.

+1 - I think this PR provides perfect parity to the imperative attachShadow() call, which just sets the slotAssignment mode but doesn't actually assign nodes. That might be enough, in that it keeps slots from being automatically assigned to slots before the imperative code boots up and assigns them.

@keithamus
Copy link
Member Author

Maybe? It seems like we want some kind of plan for it before we this feature though.

AIUI the design described in WICG/webcomponents#967 adds a new attribute to slot elements. To me this stands to reason that these become opt-in, and therefore the design is additive - which is to say if we go with the proposed solution there, I believe they can ship independently.

So I don't think landing this now would close off the design space for us; landing this will not preclude us from the design in WICG/webcomponents#967, and I suspect it doesn't close off any other potential solutions in a way which would still make sense, but I'd be happy to be corrected on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: custom elements Relates to custom elements (as defined in DOM and HTML)

Development

Successfully merging this pull request may close these issues.

5 participants