Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#12152 closed Bug (expired)

Failed to execute 'setStart' on 'Range': The offset 2 is larger than or equal to the node's length (1).

Reported by: Rob Owned by:
Priority: Normal Milestone:
Component: Core : Selection Version:
Keywords: Cc:

Description

Users get this regularly in all browsers, though they've yet to provide me good repro steps. Current example is in Chrome 35. Error bubbles up to window.onerror.

erroring line: https://github.com/ckeditor/ckeditor-dev/blob/master/core/selection.js#L1958

version: 4.4.2 (seen it as early as 4.2)

build configuration: http://ckeditor.com/builder/224773061e31c4aa24a72388cd90ca5b

Attachments (1)

scyat_error.zip (1.4 MB) - added by Rishabh 10 years ago.
Error with scyat enabled

Download all attachments as: .zip

Change History (9)

comment:1 Changed 10 years ago by Jakub Ś

Status: newpending
Version: 4.4.2

I'm sorry but this is to little information.

  1. The most important thing is providing steps to reproduce this problem. Without steps we won't be able to do anything.

Once you know how to reproduce this issue:

  1. Please send us your build-config.js
  2. If you have any Chrome Browser plugins, try disabling them and check this issue again.
  3. If you have any third-party plugins not available in standard package, please disable them, clear browser cache (this isn't not Ctrl+F5) and recheck this issue.

Changed 10 years ago by Rishabh

Attachment: scyat_error.zip added

Error with scyat enabled

comment:2 Changed 10 years ago by Rishabh

The package/configuration having the issue have been attached as scyat_error.zip file to the ticket. Following are the steps to reproduce the issue.

  1. enable scyat in configuration
  2. In the inline version of the ckeditor (/samples/inlineall.html), try inserting table.

The error is difficult to reproduce when scyat is not enabled programmatically.

The error comes up in IE 10 and IE 11 are as follows.

SCRIPT5022: IndexSizeError File: ckeditor.js, Line: 405, Column: 528 SCRIPT5007: Unable to get property 'checkReadOnly' of undefined or null reference File: ckeditor.js, Line: 331, Column: 190

In chrome it gives following error

Uncaught IndexSizeError: Failed to execute 'setStart' on 'Range': The offset 111 is larger than or equal to the node's length (23). ckeditor.js:405 CKEDITOR.dom.selection.selectRanges ckeditor.js:405 CKEDITOR.dom.selection.unlock ckeditor.js:399 CKEDITOR.editor.unlockSelection ckeditor.js:384 (anonymous function) ckeditor.js:376 h ckeditor.js:10 CKEDITOR.event.CKEDITOR.event.fire ckeditor.js:12 CKEDITOR.dom.domObject.a ckeditor.js:46 CKEDITOR.editable.CKEDITOR.tools.createClass.proto.focus ckeditor.js:327 (anonymous function) ckeditor.js:335 h ckeditor.js:10 CKEDITOR.event.CKEDITOR.event.fire ckeditor.js:12 CKEDITOR.editor.CKEDITOR.editor.fire ckeditor.js:13 CKEDITOR.tools.extend.focus ckeditor.js:245 g ckeditor.js:325 CKEDITOR.editable.CKEDITOR.tools.createClass.proto.insertElementIntoSelection ckeditor.js:332 CKEDITOR.editable.CKEDITOR.tools.createClass.proto.insertElement ckeditor.js:331 (anonymous function) ckeditor.js:335 h ckeditor.js:10 CKEDITOR.event.CKEDITOR.event.fire ckeditor.js:12 CKEDITOR.editor.CKEDITOR.editor.fire ckeditor.js:13 CKEDITOR.tools.extend.insertElement ckeditor.js:245 onOk table.js?t=E6FD:10 (anonymous function) ckeditor.js:526 h ckeditor.js:10 CKEDITOR.event.CKEDITOR.event.fire ckeditor.js:12 CKEDITOR.tools.extend.okButton.CKEDITOR.tools.extend.onClick ckeditor.js:548 (anonymous function) ckeditor.js:491 h ckeditor.js:10 CKEDITOR.event.CKEDITOR.event.fire ckeditor.js:12 CKEDITOR.ui.dialog.button.CKEDITOR.tools.extend.click ckeditor.js:490 (anonymous function) ckeditor.js:482 h ckeditor.js:10 CKEDITOR.event.CKEDITOR.event.fire ckeditor.js:12 CKEDITOR.dom.domObject.a ckeditor.js:46

Last edited 10 years ago by Rishabh (previous) (diff)

comment:3 Changed 9 years ago by yoav

Version: 4.4.5

also getting this error. on version 4.4.5. this is the build configuration: http://ckeditor.com/builder/2c49f3a8c4d3e6fa7f7a7c90dfdcda10

Uncaught IndexSizeError: Failed to execute 'setStart' on 'Range': The offset 5 is larger than or equal to the node's length (4).

CKEDITOR.editable.CKEDITOR.tools.createClass.proto.focus editable.js:77(anonymous function) editable.js:523listenerFirer event.js:144CKEDITOR.event.fire event.js:290CKEDITOR.editor.fire editor_basic.js:24CKEDITOR.tools.extend.focus

this is happening for example when writing a bit of text, then using the BOLD style, writing a bit more text. then clicking outside of the editor and then clicking inside the editor twice (need to click fairly quickly more than once but doesnt need to be double-click).

the same reported error occurs. at line: 1963 of selection.js.

this is happening with the editor in optimized or with the source uncompressed.

after that, the cursor is always at the beginning of the text.

comment:4 Changed 9 years ago by Jakub Ś

Version: 4.4.5

@rishabh91 I have tried your configuration and the only error I got was "Invalid argument" which gets thrown in scayt script and not in editor. In IE11 I have focused one of editors in inlineAll.html samples and inserted table. The key condition was that first word needs to get underlined by scayt.

This is scayt issue as has been reported to scayt team.

I didn't get any IndexSizeError. If you get this error, please provide screen cast for it and tell me if you are using default IE11 or you have got some plugins installed for it or you are using compatibility or quirks mode?


@lpyoav I haven't been able to reproduce this problem as well. Your issue looks a little bit like this one #10858. at least some comments match your description.

Just like above, could you provide screen case and additional explanations?

comment:5 Changed 9 years ago by yoav

hi j.swiderski

Ive pinpointed the cause of the problem.

We have the following code:

contentsElement = $(ckeditor.ui.space("contents").$);
            contentsElement.off("click").on("click", function (e) {
                ckeditor.focus();
            });

the contents container is bigger than the editable container so without our code, when the user clicks on the contents container which looks like its editable the focus isnt set on the editable area.

So our code improves the experience but causes the issue. a way to reproduce the issue with this code is:

  1. start typing
  2. use the bold button
  3. type a few more characters
  4. click outside of the editor - so it loses focus
  5. click once in the editable area
  6. quickly click on the contents area

the error is then thrown.

CK doesnt make sure its calling the nativeRange.setStart with valid arguments in selection.js (line 1963).

what I dont understand is why isnt CK doing the focus on the editable area when a user clicks on the contents area itself. it seems like a must-have.

https://www.dropbox.com/s/7jchmoy01her9zg/ckeditor%20areas.png

comment:6 Changed 9 years ago by Jakub Ś

@@lpyoav I have tried your configuration, plus code in one of samples of my choice but haven't managed to reproduce it.

Could I ask you to two things?

  1. Sample HTML page that can be pasted into editor samples folder and used to reproduce this error.
  2. Description was quite clear but I perhaps you could also provide screen cast for this issue.

comment:7 Changed 9 years ago by Jakub Ś

Resolution: expired
Status: pendingclosed

comment:8 Changed 9 years ago by pig.li

Any update about it, I still found the same error in our current version. http://stackoverflow.com/questions/29886961/ckeditor-error-uncaught-indexsizeerror-failed-to-execute-extend-on-selectio Thanks.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy