【问题标题】:Could not complete the operation due to error 800a025e由于错误 800a025e 无法完成操作
【发布时间】:2013-04-16 04:11:27
【问题描述】:

这个错误在 IE10/11 中是什么意思:

Error: Could not complete the operation due to error 800a025e. 

我将如何调试它?

上面写着这一行:

this.nativeSelection.removeAllRanges();

https://code.google.com/p/rangy/source/browse/trunk/src/js/core/wrappedselection.js#416

在此处查看实际操作:http://panmedia.github.io/raptor-editor/tests/cases/selection/selection-expand.html

【问题讨论】:

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


【解决方案1】:

所有错误 80020101 意味着在评估 JavaScript 时出现了某种错误。如果您通过 Ajax 加载该 JavaScript,则评估过程特别严格。

Could not complete the operation due to error 80020101. IE

【讨论】:

  • 确实,当我运行提供的代码时,我看到了 80020101
【解决方案2】:

我在尝试window.getSelection().removeAllRanges(); 时遇到此错误,并且没有选择。一种解决方法是先检查是否有选择:

if (window.getSelection().getRangeAt(0).getClientRects().length > 0) {
    window.getSelection().removeAllRanges();
}

【讨论】:

  • 你需要调用getClientRects,函数本身永远不会有长度。
【解决方案3】:

我最近遇到了这个错误,我通过以下检查修复了它:

var sel = window.document.getSelection();
if (sel.rangeCount > 0 && sel.getRangeAt(0).getClientRects().length > 0) {
    sel.removeAllRanges();
}

【讨论】:

  • 我在使用 trumbowyg html 编辑器时遇到了同样的问题。用这个解决方案修复它。谢谢
  • 这开始给我另一个 chrome 问题:“不支持不连续的选择。”我在哪里使用:selection.addRange(range)
  • 我建议另外使用window.getSelection().rangeCount(对于 Chrome,但也可能在其他环境中)。
猜你喜欢
  • 2015-08-12
  • 2014-03-20
  • 2012-04-28
  • 1970-01-01
  • 2018-09-24
  • 1970-01-01
  • 1970-01-01
  • 2012-05-28
  • 1970-01-01
相关资源
最近更新 更多