[whatwg] Control over selection direction

On Wed, 12 Jan 2011 19:35:15 -0000, Marijn Haverbeke <marijnh at gmail.com>  
wrote:

> So I propose a selectionAnchor property, which holds either "top" or
> "bottom", and can be set to one of these strings to modify the
> direction. "top" would mean the anchor lies after the base of the
> selection, so further shift-movement modifies the bottom, whereas
> "botton" means the inverse, with movement modifying the top. (I think
> the "top"/"bottom" terminology shouldn't break with any languages that
> order characters differently. Does anyone write bottom to top? If
> someone sees a problem, we could choose other terms, but these are the
> most obvious I could come up with.)

Would you use it in cases other than restoring previous selection?

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;

-- 
regards, Kornel Lesi?ski

Received on Thursday, 13 January 2011 09:31:35 UTC