Skip to content

Commit c8462cb

Browse files
committed
Insertion of empty DocumentFragment is a no-op
Also clean up the language around DocumentFragment nodes in this algorithm a bit. Tests: web-platform-tests/wpt#20659.
1 parent 37d8475 commit c8462cb

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

dom.bs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,8 +2404,26 @@ algorithm below.
24042404
before a <var>child</var>, with an optional <i>suppress observers flag</i>, run these steps:
24052405

24062406
<ol>
2407-
<li><p>Let <var>count</var> be the number of <a>children</a> of <var>node</var> if it is a
2408-
{{DocumentFragment}} <a>node</a>, and one otherwise.
2407+
<li><p>Let <var>nodes</var> be <var>node</var>'s <a>children</a>, if <var>node</var> is a
2408+
{{DocumentFragment}} <a>node</a>; otherwise « <var>node</var> ».
2409+
2410+
<li><p>Let <var>count</var> be <var>nodes</var>'s <a for=set>size</a>.
2411+
2412+
<li><p>If <var>count</var> is 0, then return.
2413+
2414+
<li>
2415+
<p>If <var>node</var> is a {{DocumentFragment}} <a>node</a>, then:
2416+
2417+
<ol>
2418+
<li><p><a for=/>Remove</a> its <a>children</a> with the <i>suppress observers flag</i> set.
2419+
2420+
<li>
2421+
<p><a>queue a tree mutation record</a> for <var>node</var> with « », <var>nodes</var>, null, and
2422+
null.
2423+
2424+
<p class="note no-backref">This step intentionally does not pay attention to the
2425+
<i>suppress observers flag</i>.
2426+
</ol>
24092427

24102428
<li>
24112429
<p>If <var>child</var> is non-null, then:
@@ -2420,20 +2438,6 @@ before a <var>child</var>, with an optional <i>suppress observers flag</i>, run
24202438
its <a for=range>end offset</a> by <var>count</var>.
24212439
</ol>
24222440

2423-
<li><p>Let <var>nodes</var> be <var>node</var>'s <a>children</a>, if <var>node</var> is a
2424-
{{DocumentFragment}} <a>node</a>; otherwise « <var>node</var> ».
2425-
2426-
<li><p>If <var>node</var> is a {{DocumentFragment}} <a>node</a>, then <a for=/>remove</a> its
2427-
<a>children</a> with the <i>suppress observers flag</i> set.
2428-
2429-
<li>
2430-
<p>If <var>node</var> is a {{DocumentFragment}} <a for=/>node</a>, then
2431-
<a>queue a tree mutation record</a> for <var>node</var> with « », <var>nodes</var>, null, and
2432-
null.
2433-
2434-
<p class="note no-backref">This step intentionally does not pay attention to the
2435-
<i>suppress observers flag</i>.
2436-
24372441
<li><p>Let <var>previousSibling</var> be <var>child</var>'s <a>previous sibling</a> or
24382442
<var>parent</var>'s <a>last child</a> if <var>child</var> is null.
24392443

0 commit comments

Comments
 (0)