Class HTMLTemplateElement
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The HTMLTemplateElement interface enables access to the contents of an HTML template element.
[Value("HTMLTemplateElement")]
public class HTMLTemplateElement : HTMLElement, Region, GeometryUtils, ParentNode, NonDocumentTypeChildNode, ChildNode, Slottable, ARIAMixin, Animatable, ElementCSSInlineStyle, GlobalEventHandlers, ElementContentEditable, HTMLOrSVGElement
- Inheritance
-
HTMLTemplateElement
- Implements
- Inherited Members
Remarks
NOTE
An HTML parser can create either an
HTMLTemplateElementor a 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.
Constructors
HTMLTemplateElement()
public HTMLTemplateElement()
Properties
Content
The content property of the HTMLTemplateElement interface returns the <template> element's template contents as a DocumentFragment. This content's NodeownerDocument is a separate Document from the one that contains the <template> element itself — unless the containing document is itself constructed for the purpose of holding template content.
[Value("content")]
public DocumentFragment Content { get; }
Property Value
Remarks
The CloneNode(bool) and ImportNode(Node, bool) methods both create a copy of a node. The difference is that importNode() clones the node in the context of the calling document, whereas cloneNode() uses the document of the node being cloned. The document context determines the CustomElementRegistry for constructing any custom elements. For this reason, use document.importNode() to clone the content fragment so that custom element descendants are constructed using the definitions in the current document, rather than the separate document that owns the template content. See the CloneNode(bool) page's examples for more details.
ShadowRootClonable
The shadowRootClonable property reflects the value of the shadowrootclonable attribute of the associated <template> element.
[Value("shadowRootClonable")]
public bool ShadowRootClonable { get; set; }
Property Value
- bool
Reflects the value of the
shadowrootclonableattribute of the associated<template>element.
Remarks
Note that this property is not useful for developers.
If a <template> element is used to declaratively create a ShadowRoot, then this object and property do not exist.
Otherwise, if an HTMLTemplateElement is created, the value of this property is irrelevant because the object is not a shadow root and cannot subsequently be changed to a shadow root.
-shadowrootclonable attribute of the <template> element
-ShadowRoot.clonable
ShadowRootDelegatesFocus
The shadowRootDelegatesFocus property of the HTMLTemplateElement interface reflects the value of the shadowrootdelegatesfocus attribute of the associated <template> element.
[Value("shadowRootDelegatesFocus")]
public bool ShadowRootDelegatesFocus { get; set; }
Property Value
- bool
Reflects the value of the
shadowrootdelegatesfocusattribute of the associated<template>element.
Remarks
Note that this property is not useful for developers.
If a <template> element is used to declaratively create a ShadowRoot, then this object and property do not exist.
Otherwise, if an HTMLTemplateElement is created, the value of this property is irrelevant because the object is not a shadow root and cannot subsequently be changed to a shadow root.
-shadowrootdelegatesfocus attribute of the <template> element
-ShadowRoot.delegatesFocus
ShadowRootMode
The shadowRootMode property of the HTMLTemplateElement interface reflects the value of the shadowrootmode attribute of the associated <template> element.
[Value("shadowRootMode")]
public string ShadowRootMode { get; set; }
Property Value
- string
Reflects the value of the
shadowrootmodeattribute of the associated<template>element.
Remarks
Note that this property is not useful for developers.
If a <template> element is used to declaratively create a ShadowRoot, then this object and property do not exist.
Otherwise, if an HTMLTemplateElement is created, the value of this property is irrelevant because the object is not a shadow root and cannot subsequently be changed to a shadow root.
-shadowrootmode attribute of the <template> element
-ShadowRoot.mode
ShadowRootSerializable
The shadowRootSerializable property reflects the value of the shadowrootserializable attribute of the associated <template> element.
[Value("shadowRootSerializable")]
public bool ShadowRootSerializable { get; set; }
Property Value
- bool
Reflects the value of the
shadowrootserializableattribute of the associated<template>element.
Remarks
Note that this property is not useful for developers.
If a <template> element is used to declaratively create a ShadowRoot, then this object and property do not exist.
Otherwise, if an HTMLTemplateElement is created, the value of this property is irrelevant because the object is not a shadow root and cannot subsequently be changed to a shadow root.
-shadowrootserializable attribute of the <template> element
-ShadowRoot.serializable