9

What does this error mean in IE10/11:

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

And how would I debug it?

It says its this line:

this.nativeSelection.removeAllRanges();

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

See it in action here: http://panmedia.github.io/raptor-editor/tests/cases/selection/selection-expand.html

Sampson
  • 265,109
  • 74
  • 539
  • 565
Petah
  • 45,477
  • 28
  • 157
  • 213

3 Answers3

4

I had this error coming up recently, I fixed it with the following chceck:

var sel = window.document.getSelection();
if (sel.rangeCount > 0 && sel.getRangeAt(0).getClientRects().length > 0) {
    sel.removeAllRanges();
}
kryssi
  • 41
  • 2
  • I had the same problem using the trumbowyg html editor. Fixed it with this solution. Thanks – woens Nov 02 '15 at 16:38
  • 1
    This started giving me another issue in chrome: "**Discontiguous selection is not supported**." where I use: `selection.addRange(range)` – mayankcpdixit Nov 22 '16 at 04:21
  • I'd suggest to additionally use `window.getSelection().rangeCount` (for Chrome, but maybe also in other environments). – BairDev Feb 24 '20 at 09:18
0

I got this error when trying to window.getSelection().removeAllRanges(); and there was no selection. One workaround is to check if there is a selection first:

if (window.getSelection().getRangeAt(0).getClientRects().length > 0) {
    window.getSelection().removeAllRanges();
}
Mike Morearty
  • 9,953
  • 5
  • 31
  • 35
Dan Dascalescu
  • 143,271
  • 52
  • 317
  • 404
-3

All the error 80020101 means is that there was an error, of some sort, while evaluating JavaScript. If you load that JavaScript via Ajax, the evaluation process is particularly strict.

Could not complete the operation due to error 80020101. IE

Community
  • 1
  • 1
maurycy
  • 8,455
  • 1
  • 27
  • 44