Selection.removeAllRanges()
Experimental
这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。
Selection.removeAllRanges()方法
会从当前selection对象中移除所有
的range对象,取消所有的选择只 留下anchorNode
和focusNode
属性并将其设置为null。
语法
sel.removeAllRanges();
参数
无。
规范
规范 | 状态 | 注释 |
---|---|---|
HTML Editing APIs Selection.removeAllRanges() |
Editor's Draft | Initial definition |
Selection API Selection.removeAllRanges() |
Working Draft | Current |
浏览器兼容性
BCD tables only load in the browser
相关链接
Selection
,此方法所属接口。