files/en-us/web/api/htmltemplateelement/index.md
{{APIRef("Web Components")}}
The HTMLTemplateElement interface enables access to the contents of an HTML {{HTMLElement("template")}} element.
[!NOTE] An HTML parser can create either an
HTMLTemplateElementor a {{domxref("ShadowRoot")}} when it parses a {{HTMLElement("template")}} element, depending on the<template>attributes. If anHTMLTemplateElementis created the "shadow" attributes are reflected from the template. However these are not useful, because anHTMLTemplateElementis not a shadow root and cannot subsequently be changed to a shadow root.
{{InheritanceDiagram}}
This interface inherits the properties of {{domxref("HTMLElement")}}.
shadowrootmode attribute of the associated <template> element.shadowrootdelegatesfocus attribute of the associated <template> element.shadowrootclonable attribute of the associated <template> element.shadowrootcustomelementregistry attribute of the associated <template> element, indicating that the declarative shadow root will use a scoped {{domxref("CustomElementRegistry")}}.shadowrootserializable attribute of the associated <template> element.This interface inherits the methods of {{domxref("HTMLElement")}}.
{{Specifications}}
{{Compat}}