-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
50 lines (33 loc) · 887 Bytes
/
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
42
43
44
45
46
47
48
49
50
---
title: "Range: cloneRange() method"
short-title: cloneRange()
slug: Web/API/Range/cloneRange
page-type: web-api-instance-method
browser-compat: api.Range.cloneRange
---
{{ APIRef("DOM") }}
The **`Range.cloneRange()`** method returns a
{{domxref("Range")}} object with boundary points identical to the cloned
{{domxref("Range")}}.
The returned clone is copied by value, not reference, so a change in either
{{domxref("Range")}} does not affect the other.
## Syntax
```js-nolint
cloneRange()
```
### Parameters
None.
### Return value
A {{domxref("Range")}} object.
## Examples
```js
range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
clone = range.cloneRange();
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- [The DOM interfaces index](/en-US/docs/Web/API/Document_Object_Model)