Re: [whatwg] Request for new DOM property textarea.selectionText

2012-06-01 Thread Ian Hickson
Context: I've added setRangeText(newText); // replace selection with newText setRangeText(newText, start, end); // replace given range with newText setRangeText(newText, start, end, action); // see below ...where action is one of: 'select': selects the new text

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-05-01 Thread Ian Hickson
On Mon, 30 Apr 2012, Ojan Vafai wrote: On Sun, Apr 29, 2012 at 2:10 PM, Maciej Stachowiak m...@apple.com wrote: 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

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-05-01 Thread Ryosuke Niwa
On Mon, Apr 30, 2012 at 11:01 PM, Ian Hickson i...@hixie.ch wrote: On Mon, 30 Apr 2012, Ojan Vafai wrote: I'd also like to see us expose a method for getting the text that accepts optional start/end arguments. Mainly, this allows for the possibility of browser vendors to performance

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-05-01 Thread Ian Hickson
On Mon, 30 Apr 2012, Ryosuke Niwa wrote: Seems like it'd be better just to have UAs optimise their JS string implementations so that it can just be backed by the same thing as the DOM or the control's editor. (I believe Mozilla may in fact already do that.) In theory, this is

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-05-01 Thread Ojan Vafai
On Mon, Apr 30, 2012 at 11:01 PM, Ian Hickson i...@hixie.ch wrote: On Mon, 30 Apr 2012, Ojan Vafai wrote: On Sun, Apr 29, 2012 at 2:10 PM, Maciej Stachowiak m...@apple.com wrote: Aryeh is referring to the DOM Range interface, which can only apply to nodes that are directly in the

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-30 Thread Biju
thanks all for discussing this... As an application developer I just want a consistent way across browser to do this operation..

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-30 Thread Ryosuke Niwa
On Sun, Apr 29, 2012 at 12:38 AM, Aryeh Gregor a...@aryeh.name wrote: In this case, we have an API, namely document.execCommand, supported by two major browser engines (for years) that provides more or less the same functionality as the proposed API. delete works in IE as well as

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-30 Thread David Young
On Sun, Apr 29, 2012 at 11:30:20PM -0400, Boris Zbarsky wrote: On 4/29/12 11:24 PM, David Young wrote: It seems that the text contents of atextarea, at least, could be properly in the DOM? Not really: when you type in a textarea, that doesn't change its actual DOM kids. Both per spec, and

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-30 Thread Boris Zbarsky
On 4/30/12 10:11 AM, David Young wrote: I guess thattextarea has worked this way for a very long time, so changing it may not be possible. I'm curious to see examples of which/how web content depends on it? I don't have links offhand, but I've definitely seen scripts assuming that getting

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-30 Thread David Young
On Mon, Apr 30, 2012 at 08:55:04AM +0300, Aryeh Gregor wrote: On Sun, Apr 29, 2012 at 11:39 PM, David Young dyo...@pobox.com wrote: I'm curious what advantages document.execCommand() has over the customary DOM API for adding/deleting/moving nodes? execCommand() does vastly more complicated

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-30 Thread Tab Atkins Jr.
On Mon, Apr 30, 2012 at 7:35 AM, David Young dyo...@pobox.com wrote: On Mon, Apr 30, 2012 at 08:55:04AM +0300, Aryeh Gregor wrote: On Sun, Apr 29, 2012 at 11:39 PM, David Young dyo...@pobox.com wrote: I'm curious what advantages document.execCommand() has over the customary DOM API for

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-30 Thread Ojan Vafai
On Sun, Apr 29, 2012 at 2:10 PM, Maciej Stachowiak m...@apple.com wrote: On Apr 29, 2012, at 1:41 PM, David Young dyo...@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 rn...@webkit.org wrote: That sounds like

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-30 Thread Ojan Vafai
On Fri, Apr 27, 2012 at 9:01 PM, Ian Hickson i...@hixie.ch wrote: On Mon, 10 May 2010, Ojan Vafai wrote: In addition to selection and scroll issues, needing to replace the entire textarea value doesn't scale and thus limits what sorts of things you can do with textareas. A general way to

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-30 Thread Aryeh Gregor
On Mon, Apr 30, 2012 at 5:35 PM, David Young dyo...@pobox.com wrote: I have seen this spec before.  It seems to have something to do with creating a word processor-like environment in the browser, something that I am acutely interested in, but there isn't much introduction/justification to it.

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-30 Thread Ryosuke Niwa
On Mon, Apr 30, 2012 at 10:41 PM, Aryeh Gregor a...@aryeh.name wrote: On Tue, May 1, 2012 at 1:03 AM, Ojan Vafai o...@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

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-29 Thread Maciej Stachowiak
Does this work in any non-WebKit browsers? (Asking mainly out of curiosity; I would tend to agree in any case that adding nontrivial editing APIs that are specific to only plaintext editable controls is not a good idea. But it might be nice to specify explicitly whether execCommand works on

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-29 Thread Aryeh Gregor
On Sun, Apr 29, 2012 at 10:29 AM, Ryosuke Niwa rn...@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

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-29 Thread David Young
On Sun, Apr 29, 2012 at 12:29:41AM -0700, Ryosuke Niwa wrote: In this case, we have an API, namely document.execCommand, supported by two major browser engines (for years) that provides more or less the same functionality as the proposed API. I'm curious what advantages document.execCommand()

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-29 Thread David Young
On Sun, Apr 29, 2012 at 10:38:26AM +0300, Aryeh Gregor wrote: On Sun, Apr 29, 2012 at 10:29 AM, Ryosuke Niwa rn...@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

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-29 Thread Maciej Stachowiak
On Apr 29, 2012, at 1:41 PM, David Young dyo...@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 rn...@webkit.org wrote: That sounds like a tangential issue. We can easily extend execCommand to support arbitrary

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-29 Thread David Young
On Sun, Apr 29, 2012 at 02:10:14PM -0700, Maciej Stachowiak wrote: 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

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-29 Thread Boris Zbarsky
On 4/29/12 11:24 PM, David Young wrote: It seems that the text contents of atextarea, at least, could be properly in the DOM? Not really: when you type in a textarea, that doesn't change its actual DOM kids. Both per spec, and in UAs, and web content depends on this. -Boris

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-29 Thread Aryeh Gregor
On Sun, Apr 29, 2012 at 11:39 PM, David Young dyo...@pobox.com wrote: I'm curious what advantages document.execCommand() has over the customary DOM API for adding/deleting/moving nodes? execCommand() does vastly more complicated things than the DOM APIs. See the spec for details:

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-28 Thread Ian Hickson
On Fri, 27 Apr 2012, Ryosuke Niwa wrote: All editing commands work inside input/textarea on WebKit although some of them have no effect (e.g. bold, italic, etc...) That sounds rather odd... I think reusing execCommand is better than adding new method for input/textarea elements for each

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-28 Thread Ryosuke Niwa
On Sat, Apr 28, 2012 at 9:30 AM, Ian Hickson i...@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

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-28 Thread Ian Hickson
On Sat, 28 Apr 2012, Ryosuke Niwa wrote: On Sat, Apr 28, 2012 at 9:30 AM, Ian Hickson i...@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

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-27 Thread Ian Hickson
On Mon, 10 May 2010, Biju wrote: Can we have a new DOM property textarea.selectionText which can be used to set/get selection text of a TEXTAREA/INPUT type=text. Gettng the value is relatively easy: On Mon, 10 May 2010, Biju wrote: Current way in firefox is to 1. OrigStart =

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-27 Thread Ryosuke Niwa
Why are we adding this new API? WebKit already supports document.execCommand('InsertText', false, new selected text); - Ryosuke On Fri, Apr 27, 2012 at 9:01 PM, Ian Hickson i...@hixie.ch wrote: On Mon, 10 May 2010, Biju wrote: Can we have a new DOM property textarea.selectionText which

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-27 Thread Ian Hickson
On Fri, 27 Apr 2012, Ryosuke Niwa wrote: Why are we adding this new API? WebKit already supports document.execCommand('InsertText', false, new selected text); That's for contenteditable regions, right? The new API is for input and textarea. Also, it's not limited to replacing the selected

Re: [whatwg] Request for new DOM property textarea.selectionText

2012-04-27 Thread Ryosuke Niwa
All editing commands work inside input/textarea on WebKit although some of them have no effect (e.g. bold, italic, etc...) I think reusing execCommand is better than adding new method for input/textarea elements for each new feature request like this one. - Ryosuke On Fri, Apr 27, 2012 at 9:36

Re: [whatwg] Request for new DOM property textarea.selectionText

2010-05-10 Thread Ojan Vafai
In addition to selection and scroll issues, needing to replace the entire textarea value doesn't scale and thus limits what sorts of things you can do with textareas. A general way to set a sub-part of a textarea's value seems useful to me. I don't think we should tie that to setting the selected

Re: [whatwg] Request for new DOM property textarea.selectionText

2010-05-10 Thread Daniel Glazman
Le 10/05/10 07:11, Biju a écrit : Can we have a new DOM property textarea.selectionText which can be used to set/get selection text of a TEXTAREA/INPUT type=text. Current method is complicated and varies between IE and Firefox Oh!!! As a read/write property, right? With my editor

Re: [whatwg] Request for new DOM property textarea.selectionText

2010-05-10 Thread Shashi
Can we have a new DOM property textarea.selectionText I definitely support this proposal. Me too, if that counts. =) -- Shashi - identi.ca/shashi