Skip to content

Commit 77ad4ca

Browse files
committed
Make adoption account for DocumentFragment nodes with hosts
Tests: ... Corresponding HTML PR: ... Closes #813 and closes #814.
1 parent 2ebc0fa commit 77ad4ca

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

dom.bs

+22-2
Original file line numberDiff line numberDiff line change
@@ -5265,10 +5265,15 @@ when invoked, must run these steps:
52655265
algorithm is passed <var>node</var> and <var>oldDocument</var>, as indicated in the <a>adopt</a>
52665266
algorithm.
52675267

5268-
<p>To <dfn export id=concept-node-adopt>adopt</dfn> a <var>node</var> into a <var>document</var>, run
5269-
these steps:
5268+
<p>To <dfn export id=concept-node-adopt>adopt</dfn> a <var>node</var> into a <var>document</var>,
5269+
with an optional <var>forceDocumentFragmentAdoption</var>, run these steps:
52705270

52715271
<ol>
5272+
<li>
5273+
<p>If <var>forceDocumentFragmentAdoption</var> is not given, then set it false.
5274+
5275+
<p class=note>This is needed for HTML's <{template}> element.
5276+
52725277
<li><p>Let <var>oldDocument</var> be <var>node</var>'s <a for=Node>node document</a>.
52735278

52745279
<li><p>If <var>node</var>'s <a for=tree>parent</a> is non-null, then <a for=/>remove</a>
@@ -5283,6 +5288,15 @@ these steps:
52835288
<a>shadow-including inclusive descendants</a>:
52845289

52855290
<ol>
5291+
<li>
5292+
<p>If <var>forceDocumentFragmentAdoption</var> is false, <var>inclusiveDescendant</var> is a
5293+
{{DocumentFragment}} <a for=/>node</a>, <var>inclusiveDescendant</var> is <var>node</var>, and
5294+
<var>node</var>'s <a for=DocumentFragment>host</a> is non-null, then
5295+
<a for=iteration>continue</a>.
5296+
5297+
<p class=note>This is only reasonable as long as all <a>adopt</a> callers remove the children
5298+
of <var>node</var>.
5299+
52865300
<li><p>Set <var>inclusiveDescendant</var>'s <a for=Node>node document</a> to <var>document</var>.
52875301

52885302
<li><p>If <var>inclusiveDescendant</var> is an <a for=/>element</a>, then set the
@@ -5312,6 +5326,12 @@ must run these steps:
53125326
<li><p>If <var>node</var> is a <a for=/>shadow root</a>, then <a>throw</a> a
53135327
"{{HierarchyRequestError!!exception}}" {{DOMException}}.
53145328

5329+
<li>
5330+
<p>If <var>node</var> is a {{DocumentFragment}} <a for=/>node</a> and its
5331+
<a for=DocumentFragment>host</a> is non-null, then return <var>node</var>.
5332+
5333+
<p class=note>Unfortunately this does not throw for web compatibility.
5334+
53155335
<li><p><a>Adopt</a> <var>node</var> into <a>this</a>.
53165336

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

0 commit comments

Comments
 (0)