ShadowRoot: serializable プロパティ
serializable
は ShadowRoot
インターフェイスの読み取り専用プロパティで、このシャドウルートがシリアライズ可能であれば、true
を返します。
設定されている場合、このシャドウルートは、Element.getHTML()
または ShadowRoot.getHTML()
メソッドを options.serializableShadowRoots
引数に true
を指定して呼び出すことでシリアライズできます。
シャドウルートの serializable プロパティは、シャドウルートが作成された際に指定されます。<template>
要素に shadowrootserializable
属性を(許可された shadowrootmode
値とともに)追加することで宣言的に指定するか、options.serializable
引数を true
に設定して Element.attachShadow()
を使用します。
値
このシャドウルートがシリアライズ可能であれば true
、そうでなければ false
。
例
js
let customElem = document.querySelector("my-shadow-dom-element");
let shadow = customElem.shadowRoot;
// ...
// シリアライズ可能かどうか
let hostElem = shadow.serializable;
仕様書
Specification |
---|
DOM # dom-shadowroot-serializable |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
serializable |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
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.