HTMLTemplateElement
Baseline Widely available *
This feature is well established and works across many devices and browser versions. It’s been available across browsers since November 2015.
* Some parts of this feature may have varying levels of support.
The HTMLTemplateElement
interface enables access to the contents of an HTML element.
Note:
An HTML parser can create either an HTMLTemplateElement
or a ShadowRoot
when it parses a element, depending on the
attributes.
If an
HTMLTemplateElement
is created the "shadow" attributes are reflected from the template.
However these are not useful, because an HTMLTemplateElement
is not a shadow root and cannot subsequently be changed to a shadow root.
Instance properties
This interface inherits the properties of HTMLElement
.
content
Read only-
A read-only
DocumentFragment
which contains the DOM subtree representing theelement's template contents.
shadowRootMode
-
A string that reflects the value of the
shadowrootmode
attribute of the associatedelement.
shadowRootDelegatesFocus
-
A boolean that reflects the value of the
shadowrootdelegatesfocus
attribute of the associatedelement.
shadowRootClonable
-
A boolean that reflects the value of the
shadowrootclonable
attribute of the associatedelement.
shadowRootSerializable
-
A boolean that reflects the value of the
shadowrootserializable
attribute of the associatedelement.
Instance methods
This interface inherits the methods of HTMLElement
.
Specifications
Specification |
---|
HTML # htmltemplateelement |