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

[whatwg] Request for new DOM property textarea.selectionText

From: Maciej Stachowiak <mjs@apple.com>
Date: Sun, 29 Apr 2012 14:10:14 -0700
Message-ID: <8D97F643-FC6B-450E-AE4F-814E907FB004@apple.com>

On Apr 29, 2012, at 1:41 PM, David Young <dyoung at pobox.com> wrote:

> On Sun, Apr 29, 2012 at 10:38:26AM +0300, Aryeh Gregor wrote:
>> On Sun, Apr 29, 2012 at 10:29 AM, Ryosuke Niwa <rniwa at webkit.org> wrote:
>>> That sounds like a tangential issue. We can easily extend execCommand to
>>> support arbitrary range(s) since such a feature is also valuable in richly
>>> editable areas.
>> 
>> Ranges don't exist in plaintext areas.  How would you get a Range
>> object that selects text in a textarea?  That's why we have separate
>> .selectionStart, .selectionEnd, etc. properties to start with.
> 
> When you say that ranges do not exist in plaintext areas (not quite sure
> what plaintext means in this context), is that for some reason, or is it
> just a historical artifact?

Aryeh is referring to the DOM Range interface, which can only apply to nodes that are directly in the DOM, and offsets into their text. The text contents of an <input> or <textarea> are not properly in the DOM, so you cannot use a DOM Range to reference such ranges. I am no sure this is what Ryosuke had in mind though; I think he just meant that in general we could support some notion of a range, and presumably we could come up with one that applies to contentEditable/designMode as well as to text controls. One extreme possibility is to simply change the definition of Range to allow it to address the contents of text input controls.

Regards,
Maciej
Received on Sunday, 29 April 2012 14:10:14 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:07 GMT