【问题标题】:IE 11 document.selection does not work [closed]IE 11 document.selection 不起作用[关闭]
【发布时间】:2014-02-14 11:09:05
【问题描述】:

我正在尝试取消选择 HTML 编辑器中的选定内容。

我已使用selection.empty() 功能取消选择内容,它在 IE10 之前可以正常工作,但在 IE11 中无法正常工作。 create 函数在 IE11 中也不起作用

这有什么替代功能吗?

【问题讨论】:

标签: internet-explorer internet-explorer-10 internet-explorer-11


【解决方案1】:

IE11 将旧版 API 替换为更符合标准的 API。

selection 不再受支持。从 Internet Explorer 11 开始,使用 getSelection

Compatibility changes in IE11

现在返回一个HTMLSelection 对象,它与旧的selection 对象不同,并且看起来empty 不是新API 中的有效方法。希望新的 API 将具有允许您执行相同逻辑的方法。

【讨论】:

    猜你喜欢
    • 2014-04-15
    • 2011-11-12
    • 2018-05-15
    • 2015-05-06
    • 2016-10-13
    • 2018-03-29
    • 2017-08-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多