[whatwg] Request for new DOM property textarea.selectionText

Ryosuke Niwa rniwa at webkit.org
Mon Apr 30 22:47:28 PDT 2012


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



More information about the whatwg mailing list