Skip to content

Commit

Permalink
Run adopt as part of insert
Browse files Browse the repository at this point in the history
Also do not allow DocumentFragment nodes with host to be adopted. This means that a DocumentFragment is no longer implicitly adopted and a DocumentFragment with a (non-null) host cannot be put in a "weird" state.

Tests: web-platform-tests/wpt#16348.

Fixes #744.
  • Loading branch information
annevk authored Dec 11, 2019
1 parent c8462cb commit c825cea
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2379,8 +2379,6 @@ of a <var>node</var> into a <var>parent</var> before a <var>child</var>, run the
<li><p>If <var>referenceChild</var> is <var>node</var>, then set <var>referenceChild</var> to
<var>node</var>'s <a for=tree>next sibling</a>.

<li><p><a>Adopt</a> <var>node</var> into <var>parent</var>'s <a for=Node>node document</a>.

<li><p><a for=/>Insert</a> <var>node</var> into <var>parent</var> before <var>referenceChild</var>.

<li><p>Return <var>node</var>.
Expand Down Expand Up @@ -2445,6 +2443,8 @@ before a <var>child</var>, with an optional <i>suppress observers flag</i>, run
<p>For each <var>node</var> in <var>nodes</var>, in <a>tree order</a>:

<ol>
<li><p><a>Adopt</a> <var>node</var> into <var>parent</var>'s <a for=Node>node document</a>.

<li><p>If <var>child</var> is null, then <a for=set>append</a> <var>node</var> to
<var>parent</var>'s <a for=tree>children</a>.

Expand Down Expand Up @@ -2557,8 +2557,6 @@ within a <var>parent</var>, run these steps:

<li><p>Let <var>previousSibling</var> be <var>child</var>'s <a>previous sibling</a>.

<li><p><a>Adopt</a> <var>node</var> into <var>parent</var>'s <a for=Node>node document</a>.

<li><p>Let <var>removedNodes</var> be the empty list.

<li>
Expand Down Expand Up @@ -2591,9 +2589,6 @@ within a <var>parent</var>, run these steps:
within a <var>parent</var>, run these steps:

<ol>
<li><p>If <var>node</var> is non-null, then <a>adopt</a> <var>node</var> into <var>parent</var>'s
<a for=Node>node document</a>.

<li><p>Let <var>removedNodes</var> be <var>parent</var>'s <a>children</a>.

<li><p>Let <var>addedNodes</var> be the empty list.
Expand Down Expand Up @@ -5308,16 +5303,18 @@ The <dfn method for=Document><code>adoptNode(<var>node</var>)</code></dfn> metho
must run these steps:

<ol>
<li>If <var>node</var> is a <a>document</a>, then <a>throw</a> a
<li><p>If <var>node</var> is a <a>document</a>, then <a>throw</a> a
"{{NotSupportedError!!exception}}" {{DOMException}}.

<li>If <var>node</var> is a <a for=/>shadow root</a>, then <a>throw</a> a
<li><p>If <var>node</var> is a <a for=/>shadow root</a>, then <a>throw</a> a
"{{HierarchyRequestError!!exception}}" {{DOMException}}.

<li><a>Adopt</a> <var>node</var>
into the <a>context object</a>.
<li><p>If <var>node</var> is a {{DocumentFragment}} <a for=/>node</a> whose
<a for=DocumentFragment>host</a> is non-null, then return.

<li><p><a>Adopt</a> <var>node</var> into the <a>context object</a>.

<li>Return <var>node</var>.
<li><p>Return <var>node</var>.
</ol>

<hr>
Expand Down

0 comments on commit c825cea

Please sign in to comment.