@@ -5260,10 +5260,15 @@ when invoked, must run these steps:
5260
5260
algorithm is passed <var> node</var> and <var> oldDocument</var> , as indicated in the <a>adopt</a>
5261
5261
algorithm.
5262
5262
5263
- <p> To <dfn export id=concept-node-adopt>adopt</dfn> a <var> node</var> into a <var> document</var> , run
5264
- these steps:
5263
+ <p> To <dfn export id=concept-node-adopt>adopt</dfn> a <var> node</var> into a <var> document</var> ,
5264
+ with an optional <var> forceDocumentFragmentAdoption </var> , run these steps:
5265
5265
5266
5266
<ol>
5267
+ <li>
5268
+ <p> If <var> forceDocumentFragmentAdoption</var> is not given, then set it false.
5269
+
5270
+ <p class=note> This is needed for HTML's <{template}> element.
5271
+
5267
5272
<li><p> Let <var> oldDocument</var> be <var> node</var> 's <a for=Node>node document</a> .
5268
5273
5269
5274
<li><p> If <var> node</var> 's <a for=tree>parent</a> is non-null, then <a for=/>remove</a>
@@ -5278,6 +5283,15 @@ these steps:
5278
5283
<a>shadow-including inclusive descendants</a> :
5279
5284
5280
5285
<ol>
5286
+ <li>
5287
+ <p> If <var> forceDocumentFragmentAdoption</var> is false, <var> inclusiveDescendant</var> is a
5288
+ {{DocumentFragment}} <a for=/>node</a> , <var> inclusiveDescendant</var> is <var> node</var> , and
5289
+ <var> node</var> 's <a for=DocumentFragment>host</a> is non-null, then
5290
+ <a for=iteration>continue</a> .
5291
+
5292
+ <p class=note> This is only reasonable as long as all <a>adopt</a> callers remove the children
5293
+ of <var> node</var> .
5294
+
5281
5295
<li><p> Set <var> inclusiveDescendant</var> 's <a for=Node>node document</a> to <var> document</var> .
5282
5296
5283
5297
<li><p> If <var> inclusiveDescendant</var> is an <a for=/>element</a> , then set the
@@ -5307,6 +5321,12 @@ must run these steps:
5307
5321
<li><p> If <var> node</var> is a <a for=/>shadow root</a> , then <a>throw</a> a
5308
5322
"{{HierarchyRequestError!!exception}} " {{DOMException}} .
5309
5323
5324
+ <li>
5325
+ <p> If <var> node</var> is a {{DocumentFragment}} <a for=/>node</a> and its
5326
+ <a for=DocumentFragment>host</a> is non-null, then return <var> node</var> .
5327
+
5328
+ <p class=note> Unfortunately this does not throw for web compatibility.
5329
+
5310
5330
<li><p> <a>Adopt</a> <var> node</var> into <a>this</a> .
5311
5331
5312
5332
<li><p> Return <var> node</var> .
0 commit comments