guardian / scribe

DEPRECATED: A rich text editor framework for the web platform
http://guardian.github.io/scribe/
Apache License 2.0
3.5k stars 245 forks source link

Selection API range property is incorrect for "backwards" selection #343

Closed deains closed 9 years ago

deains commented 9 years ago

This is a bug which looks to have been introduced by [edd638f], where getRangeAt(0) was replaced with a createRange routine.

The issue is that if you select some text backwards, i.e. anchorNode is after focusNode, the range will be empty, because although Selection is "backwards"-compatible, Range is not.

Here's a JSbin which demonstrates the issue: http://jsbin.com/wujuropeye/1/edit?html,js,output

hmgibson23 commented 9 years ago

Seems fine to me @rrees second pair of eyes?

rrees commented 9 years ago

Looks good, I think we need some tests around this though. Happy to accept the pull request as is though as it has the JSbin example. :+1:

rrees commented 9 years ago

Thanks, released in v1.2.10