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

[whatwg] Request for new DOM property textarea.selectionText

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 1 May 2012 06:26:40 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.1205010625480.19700@ps20323.dreamhostps.com>
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 possible. But any sort of proxy, etc... that lazily 
> obtain the value (e.g. delaying it until substr, etc... is called) is 
> hard to implement in practice because we need to serialize text before 
> DOM is modified. e.g.
> 
> 1 var inputValue = input.value;
> 2 var textUsed = input.value.substr(5, 10);
> 
> In the above example, inputValue could be a proxy object. However, in 
> the example below:
> 
> 1 var inputValue = input.value;
> 2 input.value = 'bar';
> 3 var textUsed = input.value.substr(5, 10);
> 
> we need to serialize the string immediately before the statement in the 
> line 2 is evaluated.

That's just copy-on-write. It's hardly rocket science. :-P

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Monday, 30 April 2012 23:26:40 GMT

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