@@ -5273,10 +5273,15 @@ when invoked, must run these steps:
5273
5273
algorithm is passed <var> node</var> and <var> oldDocument</var> , as indicated in the <a>adopt</a>
5274
5274
algorithm.
5275
5275
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:
5278
5278
5279
5279
<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
+
5280
5285
<li><p> Let <var> oldDocument</var> be <var> node</var> 's <a for=Node>node document</a> .
5281
5286
5282
5287
<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:
5291
5296
<a>shadow-including inclusive descendants</a> :
5292
5297
5293
5298
<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
+
5294
5308
<li><p> Set <var> inclusiveDescendant</var> 's <a for=Node>node document</a> to <var> document</var> .
5295
5309
5296
5310
<li><p> If <var> inclusiveDescendant</var> is an <a for=/>element</a> , then set the
@@ -5320,6 +5334,12 @@ must run these steps:
5320
5334
<li><p> If <var> node</var> is a <a for=/>shadow root</a> , then <a>throw</a> a
5321
5335
"{{HierarchyRequestError!!exception}} " {{DOMException}} .
5322
5336
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
+
5323
5343
<li><p> <a>Adopt</a> <var> node</var> into <a>this</a> .
5324
5344
5325
5345
<li><p> Return <var> node</var> .
0 commit comments