@@ -258,6 +258,14 @@ <h2>Extensibility</h2>
258
258
the new value as < var > markup</ var > , and the < a > context object</ a > as the
259
259
< var > context element</ var > .
260
260
261
+ < li > If the < a > context object</ a > is a < code > < a > template</ a > </ code > element, then let
262
+ < a > context object</ a > be the < code > < a > template</ a > </ code > 's < a > template contents</ a > (a
263
+ < code > < a > DocumentFragment</ a > </ code > ).
264
+
265
+ < p class =note > Setting < a for ="Element "> innerHTML</ a > on a < a > template</ a > element will replace
266
+ all the nodes in its < a > template contents</ a >
267
+ (< a > template</ a > .< a data-lt ="template contents "> content</ a > ) rather than its < a > children</ a > .</ p >
268
+
261
269
< li > < a > Replace all</ a > with < var > fragment</ var > within the < a > context object</ a > .
262
270
</ ol >
263
271
@@ -416,6 +424,16 @@ <h2>Extensibility</h2>
416
424
the < a > context object</ a > 's < a > next sibling</ a > .
417
425
</ dl >
418
426
</ ol >
427
+
428
+ < p class =note > No special handling for < code > < a > template</ a > </ code > elements is included in the
429
+ above "< code > afterbegin</ code > " and "< code > beforeend</ code > " cases. As with other direct
430
+ < a > Node</ a > -manipulation APIs (and unlike < a for ="Element "> innerHTML</ a > ),
431
+ < a for ="Element "> insertAdjacentHTML</ a > does not include any special handling for
432
+ < code > < a > template</ a > </ code > elements. In most cases you will wish to use
433
+ < a > template</ a > .< a data-lt ="template contents "> content</ a > .< a for ="Element "> insertAdjacentHTML</ a >
434
+ instead of directly manipulating the < a > child nodes</ a > of a < code > < a > template</ a > </ code >
435
+ element.</ p >
436
+
419
437
</ section > <!-- end Extensions to the Element interface -->
420
438
421
439
< section > < h2 > Extensions to the < code > < a > Range</ a > </ code > interface</ h2 >
@@ -586,8 +604,8 @@ <h2>Extensibility</h2>
586
604
587
605
< p > Otherwise, the algorithm for producing an < a > XML serialization</ a > is designed to produce a
588
606
serialization that is compatible with the < a > HTML parser</ a > . For example, elements in the
589
- < a > HTML namespace</ a > that contain no child nodes are serialized with an explicit begin and end
590
- tag rather than using the < a > empty-element tag</ a > syntax.
607
+ < a > HTML namespace</ a > that contain no < a > child nodes</ a > are serialized with an explicit begin and
608
+ end tag rather than using the < a > empty-element tag</ a > syntax.
591
609
592
610
< p class =note > Per [[DOM4]], < code > < a > Attr</ a > </ code > objects do not inherit from < a > Node</ a > , and
593
611
thus cannot be serialized by the < a > XML serialization algorithm</ a > . An attempt to serialize an
@@ -898,7 +916,7 @@ <h2>Extensibility</h2>
898
916
(a < code > < a > DocumentFragment</ a > </ code > ), providing the value of < var > inherited ns</ var > for
899
917
the < a > context namespace</ a > , < var > map</ var > for the < a > namespace prefix map</ a > ,
900
918
< var > prefix index</ var > for the < a > generated namespace prefix index</ a > , and the value of the
901
- < var > require well-formed</ var > flag. < span class ="note "> This allows < a > template content </ a > to
919
+ < var > require well-formed</ var > flag. < span class ="note "> This allows < a > template contents </ a > to
902
920
round-trip , given the rules for < a > parsing XHTML documents</ a > .</ span >
903
921
904
922
< li > Otherwise, append to < var > markup</ var > the result of running the
@@ -1408,7 +1426,7 @@ <h2>Dependencies</h2>
1408
1426
< dfn > < a href ="https://www.w3.org/TR/html5/single-page.html#script "> script</ a > </ dfn > and
1409
1427
< dfn > < a href ="https://www.w3.org/TR/html5/single-page.html#the-template-element "> template</ a > </ dfn >
1410
1428
< li > < dfn > < a href ="https://www.w3.org/TR/html5/single-page.html#void-elements "> void elements</ a > </ dfn >
1411
- < li > The < a > template</ a > 's < dfn data-lt =" template content " > < a href ="https://www.w3.org/TR/html5/single-page.html#template-contents "> template contents</ a > </ dfn >
1429
+ < li > The < a > template</ a > 's < dfn > < a href ="https://www.w3.org/TR/html5/single-page.html#template-contents "> template contents</ a > </ dfn >
1412
1430
</ ul >
1413
1431
1414
1432
The DOM specification [[!DOM4]] defines the following terms used in this document:
@@ -1417,7 +1435,7 @@ <h2>Dependencies</h2>
1417
1435
< li > The following concepts:
1418
1436
< dfn > < a href ="https://www.w3.org/TR/dom/#case-sensitive "> case-sensitive</ a > </ dfn > and
1419
1437
< dfn > < a href ="https://www.w3.org/TR/dom/#ascii-case-insensitive "> ASCII case-insensitive</ a > </ dfn > string comparisons;
1420
- a node's < dfn data-lt ="children |child "> < a href ="https://www.w3.org/TR/dom/#concept-tree-child "> children</ a > </ dfn > ,
1438
+ a node's < dfn data-lt ="child |child nodes "> < a href ="https://www.w3.org/TR/dom/#concept-tree-child "> children</ a > </ dfn > ,
1421
1439
< dfn > < a href ="https://www.w3.org/TR/dom/#concept-tree-first-child "> first child</ a > </ dfn > ,
1422
1440
< dfn > < a href ="https://www.w3.org/TR/dom/#concept-tree-next-sibling "> next sibling</ a > </ dfn > and
1423
1441
< dfn > < a href ="https://www.w3.org/TR/dom/#concept-tree-parent "> parent</ a > </ dfn > ;
@@ -1516,6 +1534,7 @@ <h2>Acknowledgements</h2>
1516
1534
specification is based.
1517
1535
1518
1536
< p > Thanks to
1537
+ C. Scott Ananian,
1519
1538
Victor Costan,
1520
1539
Aryeh Gregor,
1521
1540
Anne van Kesteren,
0 commit comments