[whatwg] Control over selection direction

Ryosuke Niwa rniwa at webkit.org
Thu Jan 13 09:44:41 PST 2011


2011/1/13 Kornel Lesiński <kornel at geekhood.net>
>
> If not, maybe methods to save/restore selection or modify content without
> removing selection would be better? (this would allow browsers to support
> multiple selected ranges, block selection in multiline inputs, etc.)
>
> var previousSelection = input.currentSelection; // opaque object describing
> properties of selection
> input.value = 'foo';
> input.currentSelection = previousSelection;
>

I like the idea.  Presumably, we'll have an explicit clone() method on
window.getSelection().  This will allow methods like modify() to be executed
without having to modify the actual selection, and will be a big step
forward for some editing apps like Google docs.

- Ryosuke



More information about the whatwg mailing list