Problems when selecting text next to a linebreak in Firefox

15 views
Skip to first unread message

Tobi

unread,
Jun 3, 2014, 4:15:02 AM6/3/14
to ra...@googlegroups.com
Hi Tim,

I have a problem when selecting text next to a linebreak and applying the CssClassApplierModule to it (using toggleSelection) in Firefox 29.

I am using rangy-core.js and rangy-cssapplier.js 1.3alpha.804

<div contenteditable="true">
this is text<br/>and more stuff<br/>
</div>


In this example, I would select "text" with the mouse and execute toggleSelection. This works fine, but when I call toggleSelection again without changing anything, the selection itself is changed (it now contains the whole rest of the text).

I found out that when selecting text which is next to a linebreak (br), the endContainer is the containing div itself (this is why the rest of the text is selected). This problem occurs only in Firefox: Firefox handles node bounderies of selections in a somehow random and inconsistent way.

In Firefox, the following error occurs when doing this next to the last linebreak (in this example, when selecting the word "stuff"):

"IndexSizeError: Index or size is negative or greater than the allowed amount" (in rangy-core.js).

Shall I change to the development version to see the line in the code?

Have you any solutions for this? I would also take part in some development.

regards

Tobias

Reply all
Reply to author
Forward
0 new messages