The HTMLTemplateElement.content
property returns a <template>
element's template contents (a DocumentFragment
).
Syntax
var documentFragment = templateElement.content
Example
var templateElement = document.querySelector("#foo");
var documentFragment = templateElement.content.cloneNode(true);
Specifications
Specification | Status | Comment |
HTML Living StandardThe definition of 'HTMLTemplateElement interface' in that specification. | Living Standard | |
HTML5The definition of 'HTMLTemplateElement interface' in that specification. | Recommendation | Initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
content
|
Chrome
Full support 26 |
Edge
Full support 13 |
Firefox
Full support 22 |
IE
No support No |
Opera
Full support 15 |
Safari
Full support 8 |
WebView Android
Full support Yes |
Chrome Android
Full support 26 |
Firefox Android
Full support 22 |
Opera Android
Full support Yes |
Safari iOS
Full support 8 |
Samsung Internet Android
Full support 1.5 |
Legend
- Full support
- Full support
- No support
- No support
See also
HTMLTemplateElement.content by Mozilla Contributors is licensed under CC-BY-SA 2.5.