Range.deleteContents()

Range.deleteContents() 移除来自 DocumentRange 内容。

不像Range.extractContents一样,本方法不会返回一个包含删除内容的文本片段DocumentFragment

语法

range.deleteContents()

例子

range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
range.deleteContents();

规范

规范 状态 注释
DOM
Range.deleteContents()
Living Standard No change.
Document Object Model (DOM) Level 2 Traversal and Range Specification
Range.deleteContents()
Obsolete Initial specification.

浏览器兼容性

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!

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)

参考

文档标签和贡献者

标签: 
此页面的贡献者: lbwa
最后编辑者: lbwa,