Selection.removeAllRanges()

您正在阅读此内容的英文版本,因为该语系尚未翻译。 帮助我们翻译此文章吧!

这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。

Selection.removeAllRanges()方法会从当前selection对象中移除所有的range对象,取消所有的选择只 留下anchorNodefocusNode属性并将其设置为null。

语法

sel.removeAllRanges();

参数

无。

规范

 

规范 状态 注释
HTML Editing APIs
Selection.removeAllRanges()
Editor's Draft Initial definition
Selection API
Selection.removeAllRanges()
Working Draft Current

 

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
removeAllRanges
Experimental
Chrome Full support YesEdge Full support 12Firefox Full support YesIE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.

相关链接