Range.cloneRange()
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
clone = range.cloneRange();
Example
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