[whatwg] Control over selection direction

Marijn Haverbeke marijnh at gmail.com
Fri Feb 4 03:07:23 PST 2011

See below for a revised proposal, based on the discussion here. To
move this forward, I understand I must get some people to implement
it. I'll probably eventually get to submitting a Firefox patch. If
anyone reading this list knows the people who'd be able to make this
happen on other browsers, please point them at it.


element.selectionDirection [= value]

Returns either "forward" or "backward", indicating which side of the
selection is anchored. For "forward" it is the top, for "backward" the

Can be set to one of these strings to change the side of the selection
that counts as the anchor.


The selectionDirection attribute must, on getting, return one of the
strings "forward" or "backward". "backward" is returned when the anchor, the
fixed end, of the selection lies after the base, the movable end.
"forward" is returned in all other cases.

When set to "forward" when its current value is "backward", or set to
"backward" when its current value is "forward", it must flip the roles of
the ends of the selection, so that what used to be the anchor now
becomes the base. When set to any other value, this is ignored.

More information about the whatwg mailing list