Skip to content

Commit

Permalink
Always queue mutation records after said mutations. Fixes #60.
Browse files Browse the repository at this point in the history
  • Loading branch information
nox authored and annevk committed Jul 29, 2015
1 parent 5aecfd4 commit bc31c18
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 80 deletions.
66 changes: 29 additions & 37 deletions dom.bs
Expand Up @@ -1483,30 +1483,19 @@ into a <var>parent</var> before a <var>child</var>, with an optional
a {{DocumentFragment}} <a>node</a>, and a
list containing solely <var>node</var> otherwise.

<li>
If <var>node</var> is a {{DocumentFragment}}
<a>node</a>, <a>queue a mutation record</a>
of "<code>childList</code>" for <var>node</var> with removedNodes
<var>nodes</var>.

Note: This step intentionally does not pay attention to the
<i>suppress observers flag</i>.

<li>If <var>node</var> is a {{DocumentFragment}}
<a>node</a>,
<a>remove</a> its
<a>children</a> with the
<i>suppress observers flag</i> set.

<li>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>previous sibling</a>
or <var>parent</var>'s
<a>last child</a> if
<var>child</var> is null.
<li>
If <var>node</var> is a {{DocumentFragment}} <a>node</a>,
<a>queue a mutation record</a> of "<code>childList</code>" for
<var>node</var> with removedNodes <var>nodes</var>.

Note: This step intentionally does not pay attention to the
<i>suppress observers flag</i>.

<li>
For each <var>newNode</var> in <var>nodes</var>, in
Expand All @@ -1520,6 +1509,13 @@ into a <var>parent</var> before a <var>child</var>, with an optional
<li>Run the <a>insertion steps</a> with
<var>newNode</var>.
</ol>

<li>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>previous sibling</a> or <var>parent</var>'s <a>last child</a> if
<var>child</var> is null.
</ol>


Expand Down Expand Up @@ -1740,29 +1736,25 @@ steps:
<li>Let <var>oldPreviousSibling</var> be <var>node</var>'s
<a>previous sibling</a>

<li>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>next sibling</a>,
and previousSibling <var>oldPreviousSibling</var>.

<li>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>'
{{MutationObserverInit/subtree}} 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>.

<li>Remove <var>node</var> from its <var>parent</var>.

<li>Run the <a>removing steps</a> with
<var>node</var>, <var>parent</var>, and <var>oldPreviousSibling</var>.

<li>For each <a>inclusive ancestor</a> <var>ancestor</var> of
<var>parent</var>, if <var>ancestor</var> has any <a>registered observers</a>
whose <b>options</b>' {{MutationObserverInit/subtree}} 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>.

<li>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>next sibling</a>, and previousSibling
<var>oldPreviousSibling</var>.
</ol>


Expand Down
78 changes: 35 additions & 43 deletions dom.html
Expand Up @@ -88,7 +88,7 @@
<h1 class="p-name no-ref allcaps" id="title">DOM</h1>

<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Living Standard — Last Updated
<time class="dt-updated" datetime="2015-07-28">28 July 2015</time></span></h2>
<time class="dt-updated" datetime="2015-07-29">29 July 2015</time></span></h2>

<div data-fill-with="spec-metadata">
<dl>
Expand Down Expand Up @@ -1997,34 +1997,22 @@ <h4 class="heading settled" data-level="4.2.1" id="mutation-algorithms"><span cl
list containing solely <var>node</var> otherwise.


<li>
If <var>node</var> is a <code class="idl"><a data-link-type="idl" href="#documentfragment">DocumentFragment</a></code>
<a data-link-type="dfn" href="#concept-node">node</a>, <a data-link-type="dfn" href="#queue-a-mutation-record">queue a mutation record</a>
of "<code>childList</code>" for <var>node</var> with removedNodes
<var>nodes</var>.


<p class="note" role="note">Note: This step intentionally does not pay attention to the
<i>suppress observers flag</i>.</p>



<li>If <var>node</var> is a <code class="idl"><a data-link-type="idl" href="#documentfragment">DocumentFragment</a></code>
<a data-link-type="dfn" href="#concept-node">node</a>,
<a data-link-type="dfn" href="#concept-node-remove">remove</a> its
<a data-link-type="dfn" href="#concept-tree-child">children</a> with the
<i>suppress observers flag</i> set.


<li>If <i>suppress observers flag</i> is unset,
<a data-link-type="dfn" href="#queue-a-mutation-record">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 data-link-type="dfn" href="#concept-tree-previous-sibling">previous sibling</a>
or <var>parent</var>’s
<a data-link-type="dfn" href="#concept-tree-last-child">last child</a> if
<var>child</var> is null.
<li>
If <var>node</var> is a <code class="idl"><a data-link-type="idl" href="#documentfragment">DocumentFragment</a></code> <a data-link-type="dfn" href="#concept-node">node</a>,
<a data-link-type="dfn" href="#queue-a-mutation-record">queue a mutation record</a> of "<code>childList</code>" for
<var>node</var> with removedNodes <var>nodes</var>.


<p class="note" role="note">Note: This step intentionally does not pay attention to the
<i>suppress observers flag</i>.</p>


<li>
Expand All @@ -2044,6 +2032,14 @@ <h4 class="heading settled" data-level="4.2.1" id="mutation-algorithms"><span cl

</ol>



<li>If <i>suppress observers flag</i> is unset,
<a data-link-type="dfn" href="#queue-a-mutation-record">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 data-link-type="dfn" href="#concept-tree-previous-sibling">previous sibling</a> or <var>parent</var>’s <a data-link-type="dfn" href="#concept-tree-last-child">last child</a> if
<var>child</var> is null.
</ol>


Expand Down Expand Up @@ -2317,32 +2313,28 @@ <h4 class="heading settled" data-level="4.2.1" id="mutation-algorithms"><span cl
<a data-link-type="dfn" href="#concept-tree-previous-sibling">previous sibling</a>


<li>If <i>suppress observers flag</i> is unset,
<a data-link-type="dfn" href="#queue-a-mutation-record">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 data-link-type="dfn" href="#concept-tree-next-sibling">next sibling</a>,
and previousSibling <var>oldPreviousSibling</var>.


<li>For each <a data-link-type="dfn" href="#concept-tree-ancestor">ancestor</a>
<var>ancestor</var> of <var>node</var>, if
<var>ancestor</var> has any
<a data-link-type="dfn" href="#registered-observer">registered observers</a> whose
<b>options</b>'
<code class="idl"><a data-link-type="idl" href="#dom-mutationobserverinit-subtree">subtree</a></code> is true, then
for each such <a data-link-type="dfn" href="#registered-observer">registered observer</a> <var>registered</var>, append a
<a data-link-type="dfn" href="#transient-registered-observer">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 data-link-type="dfn" href="#registered-observer">registered observers</a>.


<li>Remove <var>node</var> from its <var>parent</var>.


<li>Run the <a data-link-type="dfn" href="#concept-node-remove-ext">removing steps</a> with
<var>node</var>, <var>parent</var>, and <var>oldPreviousSibling</var>.


<li>For each <a data-link-type="dfn" href="#concept-tree-inclusive-ancestor">inclusive ancestor</a> <var>ancestor</var> of
<var>parent</var>, if <var>ancestor</var> has any <a data-link-type="dfn" href="#registered-observer">registered observers</a>
whose <b>options</b>' <code class="idl"><a data-link-type="idl" href="#dom-mutationobserverinit-subtree">subtree</a></code> is true, then for each
such <a data-link-type="dfn" href="#registered-observer">registered observer</a> <var>registered</var>, append a
<a data-link-type="dfn" href="#transient-registered-observer">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 data-link-type="dfn" href="#registered-observer">registered observers</a>.


<li>If <i>suppress observers flag</i> is unset,
<a data-link-type="dfn" href="#queue-a-mutation-record">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 data-link-type="dfn" href="#concept-tree-next-sibling">next sibling</a>, and previousSibling
<var>oldPreviousSibling</var>.
</ol>


Expand Down

0 comments on commit bc31c18

Please sign in to comment.