@@ -2279,6 +2279,36 @@ steps:
22792279 <li><p> If <var> slot</var> is non-null, then run <a>assign slottables</a> for <var> slot</var> .
22802280</ol>
22812281
2282+ <p> To <dfn noexport>update slots</dfn> , given <var> removedNodes</var> , <var> parent</var> , and
2283+ <var> addedNodes</var> , run these steps:
2284+
2285+ <ol>
2286+ <li>
2287+ <p> For each <var> removedNode</var> in <var> removedNodes</var> :
2288+
2289+ <ol>
2290+ <li><p> If <var> removedNode</var> is <a for=slotable>assigned</a> , then run
2291+ <a>assign slotables</a> for <var> removedNode</var> 's <a>assigned slot</a> .
2292+
2293+ <li><p> If <var> removedNode</var> has an <a>inclusive descendant</a> that is a <a>slot</a> , then
2294+ run <a>assign slotables for a tree</a> with <var> removedNode</var> .
2295+ </ol>
2296+
2297+ <li><p> If <var> parent</var> 's <a for=tree>root</a> is a <a for=/>shadow root</a> and
2298+ <var> parent</var> is a <a>slot</a> whose <a for=slot>assigned nodes</a> is the empty list, then run
2299+ <a>signal a slot change</a> for <var> parent</var> .
2300+
2301+ <li><p> Run <a>assign slotables for a tree</a> with <var> parent</var> 's <a for=tree>root</a> .
2302+
2303+ <li>
2304+ <p> For each <var> addedNode</var> in <var> addedNodes</var> :
2305+
2306+ <ol>
2307+ <li><p> If <var> parent</var> is a <a for=Element>shadow host</a> and <var> addedNode</var> is a
2308+ <a>slotable</a> , then <a>assign a slot</a> for <var> addedNode</var> .
2309+ </ol>
2310+ </ol>
2311+
22822312<h5 id=signaling-slot-change>Signaling slot change</h5>
22832313
22842314<p> Each <a>similar-origin window agent</a> has <dfn noexport id=signal-slot-list>signal slots</dfn>
@@ -2432,14 +2462,8 @@ before a <var>child</var>, with an optional <i>suppress observers flag</i>, run
24322462 <li><p> Otherwise, <a for=set>insert</a> <var> node</var> into <var> parent</var> 's
24332463 <a for=tree>children</a> before <var> child</var> 's <a for=tree>index</a> .
24342464
2435- <li><p> If <var> parent</var> is a <a for=Element>shadow host</a> and <var> node</var> is a
2436- <a>slottable</a> , then <a>assign a slot</a> for <var> node</var> .
2437-
2438- <li><p> If <var> parent</var> 's <a for=tree>root</a> is a <a for=/>shadow root</a> , and
2439- <var> parent</var> is a <a>slot</a> whose <a for=slot>assigned nodes</a> is the empty list,
2440- then run <a>signal a slot change</a> for <var> parent</var> .
2441-
2442- <li><p> Run <a>assign slottables for a tree</a> with <var> node</var> 's <a for=tree>root</a> .
2465+ <li><p> If the <i> suppress observers flag</i> is unset, then <a>update slots</a> with « »,
2466+ <var> parent</var> , and « <var> node</var> ».
24432467
24442468 <li>
24452469 <p> For each <a>shadow-including inclusive descendant</a> <var> inclusiveDescendant</var> of
@@ -2469,7 +2493,7 @@ before a <var>child</var>, with an optional <i>suppress observers flag</i>, run
24692493 </li>
24702494 </ol>
24712495
2472- <li><p> If <i> suppress observers flag</i> is unset, then <a>queue a tree mutation record</a> for
2496+ <li><p> If the <i> suppress observers flag</i> is unset, then <a>queue a tree mutation record</a> for
24732497 <var> parent</var> with <var> nodes</var> , « », <var> previousSibling</var> , and <var> child</var> .
24742498
24752499 <li><p> Run the <a>children changed steps</a> for <var> parent</var> .
@@ -2559,6 +2583,9 @@ within a <var>parent</var>, run these steps:
25592583 <li><p> <a for=/>Insert</a> <var> node</var> into <var> parent</var> before <var> referenceChild</var>
25602584 with the <i> suppress observers flag</i> set.
25612585
2586+ <li><p> <a>Update slots</a> with « <var> removedNodes</var> », <var> parent</var> , and
2587+ « <var> nodes</var> ».
2588+
25622589 <li><p> <a>Queue a tree mutation record</a> for <var> parent</var> with <var> nodes</var> ,
25632590 <var> removedNodes</var> , <var> previousSibling</var> , and <var> referenceChild</var> .
25642591
@@ -2585,6 +2612,9 @@ within a <var>parent</var>, run these steps:
25852612 <li><p> If <var> node</var> is non-null, then <a for=/>insert</a> <var> node</var> into
25862613 <var> parent</var> before null with the <i> suppress observers flag</i> set.
25872614
2615+ <li><p> If the <i> suppress observers flag</i> is unset, then <a>update slots</a> with
2616+ « <var> removedNodes</var> », <var> parent</var> , and « <var> addedNodes</var> ».
2617+
25882618 <li><p> If either <var> addedNodes</var> or <var> removedNodes</var> <a for=set>is not empty</a> ,
25892619 then <a>queue a tree mutation record</a> for <var> parent</var> with <var> addedNodes</var> ,
25902620 <var> removedNodes</var> , null, and null.
@@ -2649,21 +2679,8 @@ indicated in the <a for=/>remove</a> algorithm below.
26492679
26502680 <li><p> <a for=set>Remove</a> <var> node</var> from its <var> parent</var> 's <a for=tree>children</a> .
26512681
2652- <li><p> If <var> node</var> is <a for=slottable>assigned</a> , then run <a>assign slottables</a> for
2653- <var> node</var> 's <a>assigned slot</a> .
2654-
2655- <li><p> If <var> parent</var> 's <a for=tree>root</a> is a <a for=/>shadow root</a> , and
2656- <var> parent</var> is a <a>slot</a> whose <a for=slot>assigned nodes</a> is the empty list,
2657- then run <a>signal a slot change</a> for <var> parent</var> .
2658-
2659- <li>
2660- <p> If <var> node</var> has an <a>inclusive descendant</a> that is a <a>slot</a> , then:
2661-
2662- <ol>
2663- <li><p> Run <a>assign slottables for a tree</a> with <var> parent</var> 's <a for=tree>root</a> .
2664-
2665- <li><p> Run <a>assign slottables for a tree</a> with <var> node</var> .
2666- </ol>
2682+ <li><p> If the <i> suppress observers flag</i> is unset, then <a>update slots</a> with
2683+ « <var> node</var> », <var> parent</var> , and « ».
26672684
26682685 <li><p> Run the <a>removing steps</a> with <var> node</var> and <var> parent</var> .
26692686
@@ -2701,7 +2718,7 @@ indicated in the <a for=/>remove</a> algorithm below.
27012718 <a for="transient registered observer">source</a> is <var> registered</var> to <var> node</var> 's
27022719 <a>registered observer list</a> .
27032720
2704- <li><p> If <i> suppress observers flag</i> is unset, then <a>queue a tree mutation record</a> for
2721+ <li><p> If the <i> suppress observers flag</i> is unset, then <a>queue a tree mutation record</a> for
27052722 <var> parent</var> with « », « <var> node</var> », <var> oldPreviousSibling</var> , and
27062723 <var> oldNextSibling</var> .
27072724
0 commit comments