Web APIs
HTMLTemplateElement.content
Returns the DocumentFragment storing the template contents.
Formal Syntax & Structure
javascript syntaxjavascript
template.contentReturn Value
DocumentFragment
Returns the DocumentFragment storing the template contents.
Working Example
Example Snippetjavascript
(async () => {const t=document.createElement("template");t.innerHTML="<span>ready</span>";document.body.append(t);console.log(t.content.querySelector("span").textContent,document.querySelector("span")===null);})()