From 8fdf36849fd89d088f9c238be60e6126d983a1f7 Mon Sep 17 00:00:00 2001
From: Travis Leithead Setting innerHTML on a template element will replace
+ all the nodes in its template content
+ (template.content) rather than its children. No special handling for Setting innerHTML on a template element will replace
- all the nodes in its template content
- (template.content) rather than its children.Extensibility
the new value as markup, and the context object as the
context element.
+ template
element, then let
+ context object be the template
's template content (a
+ DocumentFragment
).
+
+ Extensibility
the context object's next sibling.
+
+ template
elements is included in the
+ above "afterbegin
" and "beforeend
" cases. Unlike
+ innerHTML, insertAdjacentHTML will insert the given
+ fragment into a template
's children rather than into its
+ template content.Extensions to the
@@ -894,7 +909,7 @@ Range
interfaceExtensibility
localName
matches the string "template
", then this is a
template
element. Append to markup the result of running the
- XML serialization algorithm on the template element's template contents
+ XML serialization algorithm on the template element's template content
(a DocumentFragment
), providing the value of inherited ns for
the context namespace, map for the namespace prefix map,
prefix index for the generated namespace prefix index, and the value of the
@@ -1410,7 +1425,7 @@ Dependencies
script and
template
Extensibility
context element.
template
element, then let
- context object be the template
's template content (a
+ context object be the template
's template contents (a
DocumentFragment
).
afterbegin
" and "beforeend
" cases. Unlike
innerHTML, insertAdjacentHTML will insert the given
fragment into a template
's children rather than into its
- template content.
+ template contents.
@@ -909,11 +909,11 @@ localName
matches the string "template
", then this is a
template
element. Append to markup the result of running the
- XML serialization algorithm on the template element's template content
+ XML serialization algorithm on the template element's template contents
(a DocumentFragment
), providing the value of inherited ns for
the context namespace, map for the namespace prefix map,
prefix index for the generated namespace prefix index, and the value of the
- require well-formed flag. This allows template content to
+ require well-formed flag. This allows template contents to
round-trip , given the rules for parsing XHTML documents.
template
element, then let
- context object be the template
's template contents (a
+ template
element, then let
+ context object be the template
's template contents (a
DocumentFragment
).
-
- Setting innerHTML on a template element will replace - all the nodes in its template contents + +
Setting innerHTML on a template element will replace + all the nodes in its template contents (template.content) rather than its children.
- +No special handling for template
elements is included in the
- above "afterbegin
" and "beforeend
" cases. Unlike
- innerHTML, insertAdjacentHTML will insert the given
- fragment into a template
's children rather than into its
- template contents.
No special handling for template
elements is included in the
+ above "afterbegin
" and "beforeend
" cases. As with other direct
+ Node-manipulation APIs (and unlike innerHTML),
+ insertAdjacentHTML does not include any special handling for
+ template
elements. In most cases you will wish to use
+ template.content.insertAdjacentHTML
+ instead of directly manipulating the child nodes of a template
+ element.
Range
interfaceOtherwise, the algorithm for producing an XML serialization is designed to produce a serialization that is compatible with the HTML parser. For example, elements in the - HTML namespace that contain no child nodes are serialized with an explicit begin and end - tag rather than using the empty-element tag syntax. + HTML namespace that contain no child nodes are serialized with an explicit begin and + end tag rather than using the empty-element tag syntax.
Per [[DOM4]], Attr
objects do not inherit from Node, and
thus cannot be serialized by the XML serialization algorithm. An attempt to serialize an
@@ -1434,7 +1437,7 @@
Thanks to + C. Scott Ananian, Victor Costan, Aryeh Gregor, Anne van Kesteren,