W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2011

[whatwg] Control over selection direction

From: Marijn Haverbeke <marijnh@gmail.com>
Date: Thu, 13 Jan 2011 19:54:38 +0100
Message-ID: <AANLkTimNrQU2dEVU+rUJ=jS3eg5PRfXg-BFkg27YPs0b@mail.gmail.com>
> Would you use it in cases other than restoring previous selection?

My typical use case is that I mess with the content of the input, and
then restore the selection. For example, after adding three characters
to the front, I then restore selectionStart and selectionEnd by adding
three to their original values. It seems that simply saving and
restoring a selection does not address this case.

(On top of that, I'd argue that my proposal is more 'basic', giving
programmers direct control over the DOM, rather than a convenient
interface that breaks down for corner cases. See Microsoft's original
selection API for an interesting example of a convenient API like
that.)
Received on Thursday, 13 January 2011 10:54:38 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:29 UTC