Hi, I found two issues on the Range implementation causing this bug.
The first issue is that on .start() and .end() the .move() TextRange's call is missing the 'character' unit, so the whole thing causes an error.
The second one is that for some reason extending the Range prototype with a custom toString doesn't work in IE 7-8, so toString() always return '[object Object]'. What this causes is that whenever you're setting the end using another range.end() result, only the first 15 characters of the last endContainer are selected.
and obviously change the .extend($.Range.prototype to use rangeToString instead of the function body.
For the missing unit, just change
var newPoint = $.Range(container).collapse();
//move it over offset characters
newPoint.range.move('character', offset);
this.move("START_TO_START", newPoint);
in start and
var newPoint = $.Range(container).collapse();
//move it over offset characters
newPoint.range.move('character', offset);
this.move("END_TO_START", newPoint);
Hi, I found two issues on the Range implementation causing this bug. The first issue is that on .start() and .end() the .move() TextRange's call is missing the 'character' unit, so the whole thing causes an error. The second one is that for some reason extending the Range prototype with a custom toString doesn't work in IE 7-8, so toString() always return '[object Object]'. What this causes is that whenever you're setting the end using another range.end() result, only the first 15 characters of the last endContainer are selected.
The fix
Add to the global vars:
in Range constructor, as last thing
and obviously change the .extend($.Range.prototype to use rangeToString instead of the function body.
For the missing unit, just change
in start and
in end.
Hope this helps someone!