[whatwg] Request for new DOM property textarea.selectionText

Ian Hickson ian at hixie.ch
Sat Apr 28 19:21:31 PDT 2012


On Sat, 28 Apr 2012, Ryosuke Niwa wrote:
> On Sat, Apr 28, 2012 at 9:30 AM, Ian Hickson <ian at hixie.ch> wrote:
> > >
> > > I think reusing execCommand is better than adding new method for 
> > > input/textarea elements for each new feature request like this one.
> >
> > If it was a contentEditable feature I'd reluctantly agree (reluctantly 
> > because execCommand is a terrible API), but I really don't see why 
> > execCommand() would work on input controls.
> 
> Because they're all "editing" features.

They're very different in most sense, why should they be the same in this 
one? (They have different DOM representations, different UI, different 
events, different selection APIs, most of the execCommand()s only apply to 
structured editors which neither <input> nor <textarea> have, etc...)


> How do we know someone won't suggest adding things like 
> input.insertParagraph()

Well they can suggest it, but since text inputs are single-line editors, 
they wouldn't get very far.


> or input.deleteSelectedText(), etc...

That's one of the features setRangeText supports:

   input.setRangeText('');

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list