Get to know MDN better
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 <template> element.
Note: An HTML parser can create either an HTMLTemplateElement or a ShadowRoot when it parses a <template> element, depending on the <template> 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.
This interface inherits the properties of HTMLElement.
content Read onlyA read-only DocumentFragment which contains the DOM subtree representing the <template> element's template contents.
shadowRootModeA string that reflects the value of the shadowrootmode attribute of the associated <template> element.
shadowRootDelegatesFocusA boolean that reflects the value of the shadowrootdelegatesfocus attribute of the associated <template> element.
shadowRootClonableA boolean that reflects the value of the shadowrootclonable attribute of the associated <template> element.
shadowRootCustomElementRegistryA string that reflects the value of the shadowrootcustomelementregistry attribute of the associated <template> element, indicating that the declarative shadow root will use a scoped CustomElementRegistry.
shadowRootSerializableA boolean that reflects the value of the shadowrootserializable attribute of the associated <template> element.
This interface inherits the methods of HTMLElement.
| HTML # htmltemplateelement |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Feb 22, 2026 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.