- From: Mason Freed <notifications@github.com>
- Date: Tue, 06 Apr 2021 18:41:32 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/pull/966/review/629529542@github.com>
@mfreed7 commented on this pull request.
> @@ -2192,6 +2192,10 @@ steps:</p>
<li><p>If the <i>open flag</i> is set and <var>shadow</var>'s <a for=ShadowRoot>mode</a> is
<em>not</em> "<code>open</code>", then return null.</p></li>
+ <li><p>If <var>shadow</var>'s <a for=ShadowRoot>slot assignment</a> is "<code>manual</code>",
+ then return the <a>slot</a> in <var>shadow</var>'s <a for=tree>descendants</a> whose <a>manually assigned nodes</a>
Hmm, I thought the purpose was allowing the movement of **light dom** children of the host, not the `<slot>` elements themselves. Is that an important use case?
The (potentially huge?) downside of allowing movement of both light dom children **and** slot elements is that the `manually assigned nodes` vector can start to contain duplicates all over the place. Since that vector is not developer-visible, it might get very confusing, if the order of the `<slot>` elements starts to dictate which manually-assigned node gets assigned to which slot. Consider:
```html
<div id=host>
<template shadowroot=open shadowrootmanualslotting>
<slot id=slot1></slot>
<slot id=slot2></slot>
</template>
<div id=node1></div>
<div id=node2></div>
</div>
<script>
slot1.assign([node1, node2]);
slot1.remove();
slot2.assign([node1, node2]);
// Here, both node1/node2 will be assigned to `slot2`.
host.shadowRoot.appendChild(slot1);
// Still, both node1/node2 will be assigned to `slot2`, because `slot1` comes last.
host.shadowRoot.appendChild(slot2);
// Now, both node1/node2 will be assigned to `slot1`.
</script>
```
It seems more tractable (from a developer's point of view) to have all slots within a shadow root contain unique sets of manually assigned nodes, no? Otherwise, they'll always have to call `.assign()` on any slots they append to the shadow root, to make sure the (invisible) manually assigned nodes are still what they think.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/966#discussion_r608283324
Received on Wednesday, 7 April 2021 01:41:45 UTC