[whatwg] Standard method to get/set caret position
mpt at myrealbox.com
Mon Aug 30 15:07:58 PDT 2004
On 31 Aug, 2004, at 5:36 AM, martijn wrote:
> It seems to me that the selection is the position of the cursor, not?
> When you press the left arrow key, the selection collapses and the
> cursor is at the start of where the selection was. With the right
> arrow key, the selection collapses and the cursor is at the end of
> where the selection was. Why should there also be a caret?
Because native Windows editing controls have both -- a selection, and
then a caret at either the start or the end of the selection, depending
on which direction the selection was made in. (The benefit is that it
lets you see which end of the selection Shift+Left/+Right/+Up/+Down
will alter; the drawbacks are that Left/Right are less likely to do
what you want, and that the blinking caret falsely suggests that typing
will not replace the selection.)
But such a caret is not present when a selection is made in MS Word,
nor in any Mac software I've seen, nor in MSIE on Windows or Mac OS,
and nor in Mozilla on any platform.
However, I'd be uncomfortable with any API that prevented the designers
of a future OS (for example Jef Raskin's "Humane Environment", if that
ever becomes an OS) from deciding that they will have such a caret.
More information about the whatwg