Skip to content

Commit

Permalink
Close #66: run the adopting steps recursively
Browse files Browse the repository at this point in the history
When adopting a <template>'s template contents and running its own adopting steps
as defined in HTML, if the adopting steps aren't recursively, any nested template
won't see its template contents' owner document changed.
  • Loading branch information
nox authored and annevk committed Sep 5, 2015
1 parent 2a9a923 commit 5697cf4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
25 changes: 12 additions & 13 deletions dom.bs
Expand Up @@ -4628,22 +4628,21 @@ To <dfn export for=Node id=concept-node-adopt>adopt</dfn> a <var>node</var> into
a <var>document</var>, run these steps:

<ol>
<li>Let <var>oldDocument</var> be <var>node</var>'s
<a>node document</a>.
<li><p>Let <var>oldDocument</var> be <var>node</var>'s <a>node document</a>.

<li>If <var>node</var>'s
<a>parent</a> is not null,
<a>remove</a> <var>node</var> from
its <a>parent</a>.
<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>Set <var>node</var>'s
<a>inclusive descendants</a>'s
<a>node document</a> to <var>document</var>.
<!--AttrExodus as well as any associated {{Attr}} nodes-->
<li>
<p>For each <var>descendant</var> in <var>node</var>'s <a>inclusive descendants</a>, in
<a>tree order</a>, run these substeps:

<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>Run any <a>adopting steps</a> defined for
<var>node</var> in <a>other applicable specifications</a> and pass
<var>node</var> and <var>oldDocument</var> as parameters.
<li><p>Run the <a>adopting steps</a> with <var>descendant</var> and <var>oldDocument</var>.
</ol>
</ol>

The
Expand Down
17 changes: 12 additions & 5 deletions dom.html
Expand Up @@ -2415,11 +2415,18 @@ <h3 class="heading settled" data-level="4.5" id="interface-document"><span class
<p>To <dfn data-dfn-for="Node" data-dfn-type="dfn" data-export="" id="concept-node-adopt">adopt<a class="self-link" href="#concept-node-adopt"></a></dfn> a <var>node</var> into
a <var>document</var>, run these steps:</p>
<ol>
<li>Let <var>oldDocument</var> be <var>node</var>’s <a data-link-type="dfn" href="#concept-node-document">node document</a>.
<li>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>.
<li>Set <var>node</var>’s <a data-link-type="dfn" href="#concept-tree-inclusive-descendant">inclusive descendants</a>’s <a data-link-type="dfn" href="#concept-node-document">node document</a> to <var>document</var>.
<li>Run any <a data-link-type="dfn" href="#concept-node-adopt-ext">adopting steps</a> defined for <var>node</var> in <a data-link-type="dfn" href="#other-applicable-specifications">other applicable specifications</a> and pass <var>node</var> and <var>oldDocument</var> as parameters.
<li>
<p>Let <var>oldDocument</var> be <var>node</var>’s <a data-link-type="dfn" href="#concept-node-document">node document</a>. </p>
<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>
</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 5697cf4

Please sign in to comment.