ShadowRoot: clonable property
Baseline2024Newly available
Since April 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Theclonable
read-only property of theShadowRoot
interface returnstrue
if the shadow root is clonable, andfalse
otherwise.
When the value istrue
, a shadow host cloned withNode.cloneNode()
orDocument.importNode()
will include a copy of the shadow root.
By default the value isfalse
.It can be set totrue
using theclonable
option of theElement.attachShadow()
method or by setting theshadowrootclonable
attribute of the<template>
element that is being used to declaratively attach a shadow root.
Value
true
if the shadow root is clonable, andfalse
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 |