Skip to content

Commit

Permalink
Make two loops to adopt a node
Browse files Browse the repository at this point in the history
@Ms2ger pointed out to me that the fix introduced in #66 is less than perfect,
because the unsuspecting loop over node's inclusive descendants mean running
their adopting steps in a tree of which nodes are owned by two different
documents.
  • Loading branch information
nox committed Sep 7, 2015
1 parent 5697cf4 commit 718ba4a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
15 changes: 6 additions & 9 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -4633,16 +4633,13 @@ a <var>document</var>, run these steps:
<li><p>If <var>node</var>'s <a>parent</a> is not null, <a>remove</a> <var>node</var> from its
<a>parent</a>.

<li>
<p>For each <var>descendant</var> in <var>node</var>'s <a>inclusive descendants</a>, in
<a>tree order</a>, run these substeps:
<li><p>For each <var>descendant</var> in <var>node</var>'s <a>inclusive descendants</a>, in
<a>tree order</a>, set <var>descendant</var>'s <a>node document</a> to <var>document</var>.
<!--AttrExodus as well as any associated {{Attr}} nodes-->

<ol>
<li><p>Set <var>descendant</var>'s <a>node document</a> to <var>document</var>.
<!--AttrExodus as well as any associated {{Attr}} nodes-->

<li><p>Run the <a>adopting steps</a> with <var>descendant</var> and <var>oldDocument</var>.
</ol>
<li><p>For each <var>descendant</var> in <var>node</var>'s <a>inclusive descendants</a>, in
<a>tree order</a>, run the <a>adopting steps</a> with <var>descendant</var> and
<var>oldDocument</var>.
</ol>

The
Expand Down
10 changes: 3 additions & 7 deletions dom.html
Original file line number Diff line number Diff line change
Expand Up @@ -2420,13 +2420,9 @@ <h3 class="heading settled" data-level="4.5" id="interface-document"><span class
<li>
<p>If <var>node</var>’s <a data-link-type="dfn" href="#concept-tree-parent">parent</a> is not null, <a data-link-type="dfn" href="#concept-node-remove">remove</a> <var>node</var> from its <a data-link-type="dfn" href="#concept-tree-parent">parent</a>. </p>
<li>
<p>For each <var>descendant</var> in <var>node</var>’s <a data-link-type="dfn" href="#concept-tree-inclusive-descendant">inclusive descendants</a>, in <a data-link-type="dfn" href="#concept-tree-order">tree order</a>, run these substeps: </p>
<ol>
<li>
<p>Set <var>descendant</var>’s <a data-link-type="dfn" href="#concept-node-document">node document</a> to <var>document</var>. </p>
<li>
<p>Run the <a data-link-type="dfn" href="#concept-node-adopt-ext">adopting steps</a> with <var>descendant</var> and <var>oldDocument</var>. </p>
</ol>
<p>For each <var>descendant</var> in <var>node</var>’s <a data-link-type="dfn" href="#concept-tree-inclusive-descendant">inclusive descendants</a>, in <a data-link-type="dfn" href="#concept-tree-order">tree order</a>, set <var>descendant</var>’s <a data-link-type="dfn" href="#concept-node-document">node document</a> to <var>document</var>. </p>
<li>
<p>For each <var>descendant</var> in <var>node</var>’s <a data-link-type="dfn" href="#concept-tree-inclusive-descendant">inclusive descendants</a>, in <a data-link-type="dfn" href="#concept-tree-order">tree order</a>, run the <a data-link-type="dfn" href="#concept-node-adopt-ext">adopting steps</a> with <var>descendant</var> and <var>oldDocument</var>. </p>
</ol>
<p>The <dfn class="idl-code" data-dfn-for="Document" data-dfn-type="method" data-export="" id="dom-document-adoptnode">adoptNode(<var>node</var>)<a class="self-link" href="#dom-document-adoptnode"></a></dfn> method must run these steps:</p>
<ol>
Expand Down

0 comments on commit 718ba4a

Please sign in to comment.