HTMLTemplateElement.content

The HTMLTemplateElement.content属性返回<template>元素的模板内容(一个 DocumentFragment).

语法

var documentFragment = templateElement.content

示例

var templateElement = document.querySelector("#foo");
var documentFragment = templateElement.content.cloneNode(true);

规范

Specification Status Comment
HTML Living Standard
HTMLTemplateElement interface
Living Standard
HTML5
HTMLTemplateElement interface
Recommendation Initial definition

浏览器兼容性

BCD tables only load in the browser

相关链接