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.
TheHTMLTemplateElement interface enables access to the contents of an HTML<template> element.
Note:An HTML parser can create either anHTMLTemplateElement or aShadowRoot when it parses a<template> element, depending on the<template> attributes.If anHTMLTemplateElement is created the "shadow" attributes are reflected from the template.However these are not useful, because anHTMLTemplateElement is not a shadow root and cannot subsequently be changed to a shadow root.
In this article
Instance properties
This interface inherits the properties ofHTMLElement.
contentRead onlyA read-only
DocumentFragmentwhich contains the DOM subtree representing the<template>element's template contents.shadowRootModeA string that reflects the value of the
shadowrootmodeattribute of the associated<template>element.shadowRootDelegatesFocusA boolean that reflects the value of the
shadowrootdelegatesfocusattribute of the associated<template>element.shadowRootClonableA boolean that reflects the value of the
shadowrootclonableattribute of the associated<template>element.shadowRootSerializableA boolean that reflects the value of the
shadowrootserializableattribute of the associated<template>element.
Instance methods
This interface inherits the methods ofHTMLElement.
Specifications
| Specification |
|---|
| HTML> # htmltemplateelement> |