Range: cloneRange() method
The Range.cloneRange()
method returns a
Range
object with boundary points identical to the cloned
Range
.
The returned clone is copied by value, not reference, so a change in either
Range
does not affect the other.
Syntax
js
cloneRange()
Parameters
None.
Return value
A Range
object.
Examples
js
range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
clone = range.cloneRange();
Specifications
Specification |
---|
DOM Standard # dom-range-clonerange |
Browser compatibility
BCD tables only load in the browser