web api instance method
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
cloneRange()
Parameters
None.
Return value
A Range object.
Examples
const range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
const clone = range.cloneRange();
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.