Skip to content

Commit b78f802

Browse files
noxannevk
authored andcommitted
Use a queue of deferred steps in the node insertion algorithm
1 parent 37d8475 commit b78f802

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

dom.bs

+14-10
Original file line numberDiff line numberDiff line change
@@ -2389,16 +2389,13 @@ of a <var>node</var> into a <var>parent</var> before a <var>child</var>, run the
23892389

23902390
<p><a lt="Other applicable specifications">Specifications</a> may define
23912391
<dfn export id=concept-node-insert-ext>insertion steps</dfn> for all or some <a for=/>nodes</a>. The
2392-
algorithm is passed <var ignore>insertedNode</var>, as indicated in the <a for=/>insert</a>
2393-
algorithm below.
2394-
<!-- See https://github.com/whatwg/dom/issues/34#issuecomment-125571750 for why we might need to
2395-
adjust this further based on the requirements of the script element. There might be other ways
2396-
to define that though as Olli suggests, so leaving that out for now. -->
2392+
algorithm is passed <var ignore>insertedNode</var> and <var ignore>deferredStepsQueue</var>, as
2393+
indicated in the <a for=/>insert</a> algorithm below.
23972394

23982395
<p><a lt="other applicable specifications">Specifications</a> may define
23992396
<dfn export id=concept-node-children-changed-ext>children changed steps</dfn> for all or some
2400-
<a for=/>nodes</a>. The algorithm is passed no argument and is called from <a for=/>insert</a>,
2401-
<a for=/>remove</a>, and <a for=/>replace data</a>.
2397+
<a for=/>nodes</a>. The algorithm is passed <var ignore>deferredStepsQueue</var> and is called from
2398+
<a for=/>insert</a>, <a for=/>remove</a>, and <a for=/>replace data</a>.
24022399

24032400
<p>To <dfn export id=concept-node-insert>insert</dfn> a <var>node</var> into a <var>parent</var>
24042401
before a <var>child</var>, with an optional <i>suppress observers flag</i>, run these steps:
@@ -2437,8 +2434,10 @@ before a <var>child</var>, with an optional <i>suppress observers flag</i>, run
24372434
<li><p>Let <var>previousSibling</var> be <var>child</var>'s <a>previous sibling</a> or
24382435
<var>parent</var>'s <a>last child</a> if <var>child</var> is null.
24392436

2437+
<li><p>Let <var>deferredStepsQueue</var> be an empty <a>queue</a>.
2438+
24402439
<li>
2441-
<p>For each <var>node</var> in <var>nodes</var>, in <a>tree order</a>:
2440+
<p><a for=list>For each</a> <var>node</var> in <var>nodes</var>:
24422441

24432442
<ol>
24442443
<li><p>If <var>child</var> is null, then <a for=set>append</a> <var>node</var> to
@@ -2461,7 +2460,8 @@ before a <var>child</var>, with an optional <i>suppress observers flag</i>, run
24612460
<var>node</var>, in <a>shadow-including tree order</a>:
24622461

24632462
<ol>
2464-
<li><p>Run the <a>insertion steps</a> with <var>inclusiveDescendant</var>.
2463+
<li><p>Run the <a>insertion steps</a> with <var>inclusiveDescendant</var> and
2464+
<var>deferredStepsQueue</var>.
24652465

24662466
<li>
24672467
<p>If <var>inclusiveDescendant</var> is <a>connected</a>, then:
@@ -2487,7 +2487,11 @@ before a <var>child</var>, with an optional <i>suppress observers flag</i>, run
24872487
<li><p>If <i>suppress observers flag</i> is unset, then <a>queue a tree mutation record</a> for
24882488
<var>parent</var> with <var>nodes</var>, « », <var>previousSibling</var>, and <var>child</var>.
24892489

2490-
<li><p>Run the <a>children changed steps</a> for <var>parent</var>.
2490+
<li><p>Run the <a>children changed steps</a> for <var>parent</var> with
2491+
<var>deferredStepsQueue</var>.
2492+
2493+
<li><p>While <var>deferredStepsQueue</var> <a for=list>is not empty</a>, run the result of
2494+
<a>dequeueing</a> <var>deferredStepsQueue</var>.
24912495
</ol>
24922496

24932497

0 commit comments

Comments
 (0)