Reputation: 2135
I have an editable iframe with some textnodes. During editing i want (on some condition) set the cursor to the start of a text node. In FireFox this works fine using the following code. In Chrome instead the cursor is set to the end of the previous sibling (also text node). I am using this code:
/* get selection */
var selection = this.iframewin.getSelection();
/* create new range */
var newrange = this.iframedoc.createRange();
newrange.setStart(textnode, 0);
newrange.setEnd(textnode, 0);
/* set new range */
selection.removeAllRanges();
selection.addRange(newrange);
As far as i know both FireFox and Chrome do fully comply with the DOM Range spec. So shouldn't they handle this code equally? Or am i doing something else wrong? If you need any further information please ask.
Edit: Just after posting i found the bug report that describes this for Chrome:
https://bugs.webkit.org/show_bug.cgi?id=23189
So i think Chrome users have to deal with that.
Upvotes: 1
Views: 662
Reputation: 2135
Just after posting i found the bug report that describes this for Chrome:
https://bugs.webkit.org/show_bug.cgi?id=23189
So i think Chrome users have to deal with that.
Upvotes: 2