W3cubDocs

/DOM

HTMLTemplateElement.content

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.importNode(true);

Specifications

Specification Status Comment
WHATWG HTML Living Standard
The definition of 'HTMLTemplateElement interface' in that specification.
Living Standard
HTML5
The definition of 'HTMLTemplateElement interface' in that specification.
Recommendation Initial definition

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 26 13 22 (22) No support 15 7.1
Feature Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support ? (Yes) ? No support ? iOS 8

See also

© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLTemplateElement/content