@@ -2389,12 +2389,10 @@ of a <var>node</var> into a <var>parent</var> before a <var>child</var>, run the
2389
2389
</ol>
2390
2390
2391
2391
<p> <a lt="Other applicable specifications">Specifications</a> may define
2392
- <dfn export id=concept-node-insert-ext>insertion steps</dfn> for all or some <a for=/>nodes</a> . The
2393
- algorithm is passed <var ignore> insertedNode</var> , as indicated in the <a for=/>insert</a>
2394
- algorithm below.
2395
- <!-- See https://github.com/whatwg/dom/issues/34#issuecomment-125571750 for why we might need to
2396
- adjust this further based on the requirements of the script element. There might be other ways
2397
- to define that though as Olli suggests, so leaving that out for now. -->
2392
+ <dfn export id=concept-node-insert-ext>insertion steps</dfn> or
2393
+ <dfn export id=concept-node-children-added>children added steps</dfn> for all or some
2394
+ <a for=/>nodes</a> . The two algorithms are passed <var ignore> insertedNode</var> and
2395
+ <var ignore> deferredStepsQueue</var> , as indicated in the <a for=/>insert</a> algorithm below.
2398
2396
2399
2397
<p> To <dfn export id=concept-node-insert>insert</dfn> a <var> node</var> into a <var> parent</var>
2400
2398
before a <var> child</var> , with an optional <i> suppress observers flag</i> , run these steps:
@@ -2440,8 +2438,12 @@ before a <var>child</var>, with an optional <i>suppress observers flag</i>, run
2440
2438
<li><p> Let <var> previousSibling</var> be <var> child</var> 's <a>previous sibling</a> or
2441
2439
<var> parent</var> 's <a>last child</a> if <var> child</var> is null.
2442
2440
2441
+ <li><p> Let <var> deferredStepsQueue</var> be an empty <a>queue</a> .
2442
+
2443
+ <li><p> Let <var> textChanged</var> be false.
2444
+
2443
2445
<li>
2444
- <p> For each <var> node</var> in <var> nodes</var> , in <a>tree order</a > :
2446
+ <p> <a for=list> For each</a> <var> node</var> in <var> nodes</var> :
2445
2447
2446
2448
<ol>
2447
2449
<li><p> If <var> child</var> is null, then <a for=set>append</a> <var> node</var> to
@@ -2453,8 +2455,7 @@ before a <var>child</var>, with an optional <i>suppress observers flag</i>, run
2453
2455
<li><p> If <var> parent</var> is a <a for=Element>shadow host</a> and <var> node</var> is a
2454
2456
<a>slotable</a> , then <a>assign a slot</a> for <var> node</var> .
2455
2457
2456
- <li> If <var> node</var> is a {{Text}} node, run the <a>child text content change steps</a> for
2457
- <var> parent</var> .
2458
+ <li> If <var> node</var> is a {{Text}} node, then set <var> textChanged</var> to true.
2458
2459
2459
2460
<li><p> If <var> parent</var> 's <a for=tree>root</a> is a <a for=/>shadow root</a> , and
2460
2461
<var> parent</var> is a <a>slot</a> whose <a for=slot>assigned nodes</a> is the empty list,
@@ -2467,7 +2468,8 @@ before a <var>child</var>, with an optional <i>suppress observers flag</i>, run
2467
2468
<var> node</var> , in <a>shadow-including tree order</a> :
2468
2469
2469
2470
<ol>
2470
- <li><p> Run the <a>insertion steps</a> with <var> inclusiveDescendant</var> .
2471
+ <li><p> Run the <a>insertion steps</a> with <var> inclusiveDescendant</var> and
2472
+ <var> deferredStepsQueue</var> .
2471
2473
2472
2474
<li>
2473
2475
<p> If <var> inclusiveDescendant</var> is <a>connected</a> , then:
@@ -2490,6 +2492,22 @@ before a <var>child</var>, with an optional <i>suppress observers flag</i>, run
2490
2492
</li>
2491
2493
</ol>
2492
2494
2495
+ <li><p> If <var> textChanged</var> is true, then run the <a>child text content change steps</a> for
2496
+ <var> parent</var> .
2497
+
2498
+ <li><p> If <var> nodes</var> is not empty, then run the <a>children added steps</a> with
2499
+ <var> parent</var> and <var> deferredStepsQueue</var> .
2500
+
2501
+ <li>
2502
+ <p> While <var> deferredStepsQueue</var> <a for=list>is not empty</a> :
2503
+
2504
+ <ol>
2505
+ <li><p> Let <var> deferredSteps</var> be the result of <a for=queue>dequeueing</a>
2506
+ <var> deferredStepsQueue</var> .
2507
+
2508
+ <li><p> Run <var> deferredSteps</var> .
2509
+ </ol>
2510
+
2493
2511
<li><p> If <i> suppress observers flag</i> is unset, then <a>queue a tree mutation record</a> for
2494
2512
<var> parent</var> with <var> nodes</var> , « », <var> previousSibling</var> , and <var> child</var> .
2495
2513
</ol>
0 commit comments