- Notifications
You must be signed in to change notification settings - Fork 22.7k
/
Copy pathindex.md
41 lines (28 loc) · 1.16 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
title: "ShadowRoot: clonable property"
short-title: clonable
slug: Web/API/ShadowRoot/clonable
page-type: web-api-instance-property
browser-compat: api.ShadowRoot.clonable
---
{{APIRef("Shadow DOM")}}
The **`clonable`** read-only property of the {{domxref("ShadowRoot")}} interface returns `true` if the shadow root is clonable, and `false` otherwise.
When the value is `true`, a shadow host cloned with {{domxref("Node.cloneNode()")}} or {{domxref("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 {{domxref("Element.attachShadow()")}} method or by setting the [`shadowrootclonable`](/en-US/docs/Web/HTML/Reference/Elements/template#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
consthost=document.createElement("div");
constshadowRoot=host.attachShadow({
mode:"open",
clonable:true,
});
shadowRoot.clonable;
// true
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}