The HTMLTemplateElement.content
property returns a <template>
element's template contents (a DocumentFragment
).
The HTMLTemplateElement.content
property returns a <template>
element's template contents (a DocumentFragment
).
js
const templateElement = document.querySelector("#foo"); const documentFragment = templateElement.content.cloneNode(true);
Specification |
---|
HTML Standard # dom-template-content-dev |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
content |
26 | 13 | 22 | No | 15 | 8 | 4.4 | 26 | 22 | 14 | 8 | 1.5 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLTemplateElement/content