2011/1/13 Kornel Lesiński <[email protected]> > > 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
