Skip to content

Commit 9a1e814

Browse files
committed
Make adoption account for DocumentFragment nodes with hosts
Tests: ... Corresponding HTML PR: ... Closes #813 and closes #814.
1 parent 0e4ee38 commit 9a1e814

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

Diff for: dom.bs

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

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

52795279
<ol>
5280+
<li>
5281+
<p>If <var>forceDocumentFragmentAdoption</var> is not given, then set it false.
5282+
5283+
<p class=note>This is needed for HTML's <{template}> element.
5284+
52805285
<li><p>Let <var>oldDocument</var> be <var>node</var>'s <a for=Node>node document</a>.
52815286

52825287
<li><p>If <var>node</var>'s <a for=tree>parent</a> is non-null, then <a for=/>remove</a>
@@ -5291,6 +5296,15 @@ these steps:
52915296
<a>shadow-including inclusive descendants</a>:
52925297

52935298
<ol>
5299+
<li>
5300+
<p>If <var>forceDocumentFragmentAdoption</var> is false, <var>inclusiveDescendant</var> is a
5301+
{{DocumentFragment}} <a for=/>node</a>, <var>inclusiveDescendant</var> is <var>node</var>, and
5302+
<var>node</var>'s <a for=DocumentFragment>host</a> is non-null, then
5303+
<a for=iteration>continue</a>.
5304+
5305+
<p class=note>This is only reasonable as long as all <a>adopt</a> callers remove the children
5306+
of <var>node</var>.
5307+
52945308
<li><p>Set <var>inclusiveDescendant</var>'s <a for=Node>node document</a> to <var>document</var>.
52955309

52965310
<li><p>If <var>inclusiveDescendant</var> is an <a for=/>element</a>, then set the
@@ -5320,6 +5334,12 @@ must run these steps:
53205334
<li><p>If <var>node</var> is a <a for=/>shadow root</a>, then <a>throw</a> a
53215335
"{{HierarchyRequestError!!exception}}" {{DOMException}}.
53225336

5337+
<li>
5338+
<p>If <var>node</var> is a {{DocumentFragment}} <a for=/>node</a> and its
5339+
<a for=DocumentFragment>host</a> is non-null, then return <var>node</var>.
5340+
5341+
<p class=note>Unfortunately this does not throw for web compatibility.
5342+
53235343
<li><p><a>Adopt</a> <var>node</var> into <a>this</a>.
53245344

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

0 commit comments

Comments
 (0)