Range.deleteContents()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.
Range.deleteContents()
移除来自 Document
的Range
内容。
不像Range.extractContents
一样,本方法不会返回一个包含删除内容的文本片段DocumentFragment
。
语法
range.deleteContents()
例子
js
range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
range.deleteContents();
规范
Specification |
---|
DOM Standard # dom-range-deletecontents |
浏览器兼容性
BCD tables only load in the browser