web api interface
HTMLTemplateElement
The HTMLTemplateElement interface enables access to the contents of an HTML <template> element.
[!NOTE] An HTML parser can create either an
HTMLTemplateElementor aShadowRootwhen it parses a<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.
Instance properties
This interface inherits the properties of HTMLElement.
contentRead only- : A read-only
DocumentFragmentwhich contains the DOM subtree representing the<template>element’s template contents.
- : A read-only
shadowRootMode- : A string that reflects the value of the
shadowrootmodeattribute of the associated<template>element.
- : A string that reflects the value of the
shadowRootDelegatesFocus- : A boolean that reflects the value of the
shadowrootdelegatesfocusattribute of the associated<template>element.
- : A boolean that reflects the value of the
shadowRootClonable- : A boolean that reflects the value of the
shadowrootclonableattribute of the associated<template>element.
- : A boolean that reflects the value of the
shadowRootCustomElementRegistry- : A string that reflects the value of the
shadowrootcustomelementregistryattribute of the associated<template>element, indicating that the declarative shadow root will use a scopedCustomElementRegistry.
- : A string that reflects the value of the
shadowRootSerializable- : A boolean that reflects the value of the
shadowrootserializableattribute of the associated<template>element.
- : A boolean that reflects the value of the
shadowRootSlotAssignment- : A string that reflects the value of the
shadowrootslotassignmentattribute of the associated<template>element.
- : A string that reflects the value of the
Instance methods
This interface inherits the methods of HTMLElement.
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.