Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年11月.
* Some parts of this feature may have varying levels of support.
HTMLTemplateElement インターフェイスは、HTML の <template> 要素の内容にアクセスできるようにします。
メモ: HTML パーサーは、<template> 要素を構文解析する際に、その <template> 属性に応じて、HTMLTemplateElement または ShadowRoot のどちらかを生成する可能性があります。 HTMLTemplateElement が作成されると、"shadow" 属性がテンプレートから反映されます。 しかし、これらは有用ではありません。HTMLTemplateElement はシャドウルートではなく、シャドウルートに変更することができないからです。
このインターフェイスには HTMLElement から継承したプロパティがあります。
content 読取専用読み取り専用の DocumentFragment で、 <template> 要素のテンプレートの内容を表す DOM サブツリーを返します。
shadowRootMode文字列で、関連付けられた <template> 要素の shadowrootmode 属性の値を反映します。
shadowRootDelegatesFocus論理値で、関連付けられた <template> 要素の shadowrootdelegatesfocus 属性の値を反映します。
shadowRootClonable論理値で、関連付けられた <template> 要素の shadowrootclonable 属性の値を反映します。
shadowRootSerializable論理値で、関連付けられた <template> 要素の shadowrootserializable 属性の値を反映します。
このインターフェイスには HTMLElement から継承したメソッドがあります。
| HTML # htmltemplateelement |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年4月12日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.