Skip to content
This repository was archived by the owner on Nov 11, 2019. It is now read-only.

Commit e6560c0

Browse files
Hongbo Minyongsheng
authored andcommitted
Fix #39: Part I: Always queue mutation records after said mutations.
Queuing of mutation records looks inconsistent. To replace a child with node within a parent, the mutation record should be queued after the removal of child and insertion of node. See whatwg#60 for more details.
1 parent 232f575 commit e6560c0

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

sections/nodes.include

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,10 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0D%
168168
<li><p>Let <var>nodes</var> be <var>node</var>'s <a>children</a> if <var>node</var> is a <code><a>DocumentFragment</a></code> <a>node</a>, and a list containing solely <var>node</var> otherwise.
169169

170170
<li>
171+
<li><p>If <var>node</var> is a <code><a>DocumentFragment</a></code> <a>node</a>, <a href="#node-remove">remove</a> its <a>children</a> with the <i>suppress observers flag</i> set.
171172
<p>If <var>node</var> is a <code><a>DocumentFragment</a></code> <a>node</a>, <a>queue a mutation record</a> of "<code>childList</code>" for <var>node</var> with removedNodes <var>nodes</var>.
172173

173174
<p class="note">Note: This step intentionally does not pay attention to the <i>suppress observers flag</i>.
174-
175-
<li><p>If <var>node</var> is a <code><a>DocumentFragment</a></code> <a>node</a>, <a href="#node-remove">remove</a> its <a>children</a> with the <i>suppress observers flag</i> set.
176-
177-
<li><p>If <i>suppress observers flag</i> is unset, <a>queue a mutation record</a> of "<code>childList</code>" for <var>parent</var> with addedNodes <var>nodes</var>, nextSibling <var>child</var>, and previousSibling <var>child</var>'s <a href="#tree-previous-sibling">previous sibling</a> or <var>parent</var>'s <a>last child</a> if <var>child</var> is null.
178-
179175
<li>
180176
<p>For each <var>newNode</var> in <var>nodes</var>, in <a>tree order</a>, run these substeps:
181177

@@ -184,6 +180,8 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0D%
184180

185181
<li><p>Run the <a>insertion steps</a> with <var>newNode</var>.
186182
</ol>
183+
<li><p>If <i>suppress observers flag</i> is unset, <a>queue a mutation record</a> of "<code>childList</code>" for <var>parent</var> with addedNodes <var>nodes</var>, nextSibling <var>child</var>, and previousSibling <var>child</var>'s <a href="#tree-previous-sibling">previous sibling</a> or <var>parent</var>'s <a>last child</a> if <var>child</var> is null.
184+
187185
</ol>
188186

189187

@@ -287,11 +285,10 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0D%
287285
<li><p>If <i>suppress observers flag</i> is unset, <a>queue a mutation record</a> of "<code>childList</code>" for <var>parent</var> with removedNodes a list solely containing <var>node</var>, nextSibling <var>node</var>'s <a href="#tree-next-sibling">next sibling</a>,
288286
and previousSibling <var>oldPreviousSibling</var>.
289287

290-
<li><p>For each <a>ancestor</a> <var>ancestor</var> of <var>node</var>, if <var>ancestor</var> has any <a>registered observers</a> whose <b>options</b>'s <code>subtree</code> is true, then for each such <a>registered observer</a> <var>registered</var>, append a <a>transient registered observer</a> whose <b>observer</b> and <b>options</b> are identical to those of <var>registered</var> and <b>source</b> which is <var>registered</var> to <var>node</var>'s list of <a>registered observers</a>.
291-
292288
<li><p>Remove <var>node</var> from its <var>parent</var>.
293289

294290
<li><p>Run the <a>removing steps</a> with <var>node</var>, <var>parent</var>, and <var>oldPreviousSibling</var>.
291+
<li><p>For each <a>ancestor</a> <var>ancestor</var> of <var>node</var>, if <var>ancestor</var> has any <a>registered observers</a> whose <b>options</b>'s <code>subtree</code> is true, then for each such <a>registered observer</a> <var>registered</var>, append a <a>transient registered observer</a> whose <b>observer</b> and <b>options</b> are identical to those of <var>registered</var> and <b>source</b> which is <var>registered</var> to <var>node</var>'s list of <a>registered observers</a>.
295292
</ol>
296293

297294
<h4 id="interface-nonelementparentnode">Interface <code><a>NonElementParentNode</a></code></h4>

0 commit comments

Comments
 (0)