Range.cloneRange()
Range.cloneRange()
方法返回一个range对象,并且该对象的范围边界点与被克隆的range对象相同。
克隆的对象是复制过来的,而非引用,所以这两个对象双方各自做出的改变,都不会影响另一方。
语法
clone = range.cloneRange();
Example
range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
clone = range.cloneRange();
Specifications
Specification | Status | Comment |
---|---|---|
DOM Range.cloneRange() |
Living Standard | No change. |
Document Object Model (DOM) Level 2 Traversal and Range Specification Range.cloneRange() |
Obsolete | Initial specification. |
Browser compatibility
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help! (en-US)
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | 1.0 (1.7 or earlier) | 9.0 | 9.0 | (Yes) |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | 1.0 (1.0) | 9.0 | 9.0 | (Yes) |