Add shadowrootslotassignment attribute#43753
Conversation
|
Thank you. Is there an existing browser implementation? It seems to be missing from BCD for now. |
|
It seems like it's not implemented yet. So I would keep this PR open until the first experimental implementation lands, as we only document features supported by browsers. Thank you again for doing this in advance! |
c4c9d81 to
01414b1
Compare
Right. https://groups.google.com/a/mozilla.org/g/dev-platform/c/8qxAHE9-Xdo is my intent to ship this in Firefox. I'll work on adding BCD definitions. |
Preview URLs (7 pages)
External URLs (2)URL:
URL:
(comment last updated: 2026-05-15 06:04:46) |
ce2b217 to
24afef4
Compare
4893b1c to
dab8147
Compare
|
@keithamus THanks for this. I'm supported to sort out docs for the FF151 release - have updated BCD and release note. Let me know what help you need to push this over the line. |
|
@hamishwillee happy to have you take over this PR if you have time. I won’t be able to get to it until late next week or so. |
|
From #43753 (comment)
Thanks @keithamus . I've tried to integrate your comments in the section added in https://github.com/mdn/content/pull/43753/changes#r3224439661 - it updates the slots guide, which I think needed this. @keithamus Can you please check this ALL sometime soon? I can merge it of course, as I have the power, but it isn't right that I should do so without you checking it. I am happy with it "broadly" |
chrisdavidmills
left a comment
There was a problem hiding this comment.
@hamishwillee I had a look around as requested, and ended up doing a full review ;-)
Really interesting stuff.
| - `mode` | ||
| - : A string specifying the _encapsulation mode_ for the shadow DOM tree. | ||
| This can be one of: | ||
| - `open` |
There was a problem hiding this comment.
These descriptions should be pared down, and the code snippets placed in an explainer section in the "Description".
| customElements.define("my-custom-element", MyCustomElement); | ||
| ``` | ||
|
|
||
| ### Shadow DOM with named slot assignment |
There was a problem hiding this comment.
Given this is the default, this example feels a little verbose:
- named slot assignment is quite well supported (I think back to Safari 10, Firefox 63, Chrome 53 or so?)
- The
slotAssignmentIDL is only recently supported due to the addition ofmanualslot assignment, so that seems like a more relevant example - especially when it comes to feature detection.
There was a problem hiding this comment.
Fair enough. What I have done here is simplied the example to remove the feature test and not even specify the slot assignment. It is still worth showing.
Then I have added a second example that shows the manual assignment - same output but done manually.
It is not a great example of the possibilities - we should improve the example in the Using template and slots guide for that (a job for another day). However it does show quite clearly how it works.
Co-authored-by: Hamish Willee <[email protected]>
Co-authored-by: Chris Mills <[email protected]> Co-authored-by: Keith Cirkel <[email protected]> Co-authored-by: Hamish Willee <[email protected]>
fbc8a20 to
1ff77a4
Compare
|
Thanks @chrisdavidmills and @keithamus - I've done fixes for all of this. I think a lot better. One possible further change (in addition to whatever else you need) is possibly choosing to refer to "unnamed" as "manual"? It is easier to parse as a reader. |
chrisdavidmills
left a comment
There was a problem hiding this comment.
This all looks fine from my perspective. I won't merge yet, but I will approve to avoid blocking further progress.
|
Thanks @chrisdavidmills . I'm going to merge as it is much more clear than what preceded it. Certainly more could be done but I'd like to get what we have here in for the FF151 release tomorrow. @keithamus If you have further comments, in particular to the idea in #43753 (comment), they would be welcome but we can do as a post process. Thanks for kicking this off too - saved a lot of time. |
Description
This adds docs for the
shadowrootslotassignmentattribute.Motivation
Trying to add the docs so that whatwg/html#12267 can be merged.
Additional details
I've largely cribbed the docs style from the other
shadowroot*attributes.Related issues and pull requests