ShadowRoot: clonable property
The clonable
read-only property of the ShadowRoot
interface returns true
if the shadow root is clonable, and false
otherwise.
When the value is true
, a shadow host cloned with Node.cloneNode()
or Document.importNode()
will include a copy of the shadow root.
By default the value is false
.
It can be set to true
using the clonable
option of the Element.attachShadow()
method or by setting the shadowrootclonable
attribute of the <template>
element that is being used to declaratively attach a shadow root.
Value
true
if the shadow root is clonable, and false
otherwise.
Examples
js
const host = document.createElement("div");
const shadowRoot = host.attachShadow({
mode: "open",
clonable: true,
});
shadowRoot.clonable;
// true
Specifications
Specification |
---|
DOM # dom-shadowroot-clonable |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
clonable |
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.