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

[whatwg] Control over selection direction

From: Tim Down <timdown@gmail.com>
Date: Fri, 14 Jan 2011 11:53:39 +0000
Message-ID: <AANLkTimVw7hA1w6A-Netv3YxT1N+p=4fkDxh2MTF4Dum@mail.gmail.com>
On 14 January 2011 11:33, Marijn Haverbeke <marijnh at gmail.com> wrote:
>> If you don't need the TextRange-like character-based modification, you
>> can instead use the selection's extend() method (supported in Mozilla,
>> WebKit and Opera for years) to create a backwards selection:
> Maybe that is what you meant by this not working for TextRange-like
> things, but, unfortunately, the regular selection primitives do not
> appear to treat the content of text input and textarea elements as
> separate elements. I can use this trick to create a reversed selection
> that starts at the start of the textarea, but not one starting at an
> arbitrary character.

I'm sorry, I thought you were referring to regular selections as
opposed to inputs or textareas, since you mentioned
window.getSelection(). It hadn't occurred to me to use modify() to try
and affect the selection in a textarea.

Received on Friday, 14 January 2011 03:53:39 UTC

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