W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2012

[whatwg] Request for new DOM property textarea.selectionText

From: Ryosuke Niwa <rniwa@webkit.org>
Date: Mon, 30 Apr 2012 22:47:28 -0700
Message-ID: <CABNRm63fpHi6oOoC4RsQgbC1u2SwXV9gXtORnqCDm6n9dh395A@mail.gmail.com>
On Mon, Apr 30, 2012 at 10:41 PM, Aryeh Gregor <ayg at aryeh.name> wrote:
>  On Tue, May 1, 2012 at 1:03 AM, Ojan Vafai <ojan at chromium.org> wrote:
> > This looks good to me. Could we just call the method setText though since
> > the range values are optional. setRangeText, in retrospect, is wordy and
> > confusing in a way that setText isn't IMO.
> .setText("foo") sounds like it should set the entire text, not just
> the selected text.

I think the problem is that it automatically uses selectionStart &
selectionEnd when offsets are not supplied.
The semantics would have been much clearer if offsets were not optional.

I'd argue that we should either disallow setText without offsets, or
setText should use 0 and the length of the text field instead of
selectionStart and selectionEnd respectively when offsets are omitted.

- Ryosuke
Received on Monday, 30 April 2012 22:47:28 UTC

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