W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2011

Re: Node append

From: Sean Hogan <shogun70@westnet.com.au>
Date: Tue, 04 Oct 2011 07:53:07 +1100
Message-ID: <4E8A20B3.2080408@westnet.com.au>
To: Erik Arvidsson <arv@chromium.org>
CC: Aryeh Gregor <ayg@aryeh.name>, Olli@pettay.fi, Ojan Vafai <ojan@chromium.org>, Boris Zbarsky <bzbarsky@mit.edu>, Robin Berjon <robin@berjon.com>, www-dom@w3.org
On 4/10/11 4:01 AM, Erik Arvidsson wrote:
> On Sun, Oct 2, 2011 at 13:10, Aryeh Gregor<ayg@aryeh.name>  wrote:
>> On Sun, Oct 2, 2011 at 6:38 AM, Olli Pettay<Olli.Pettay@helsinki.fi>  wrote:
>>> Why? Why couldn't there be separate method(s) which take string/array etc
>>> and keep the old appendChild etc as they are now (in DOM 3, not in latest
>>> DOM 4 draft)
>> I concur with this.  Reasons to prefer separate methods are
>>
>> 1) It's unclear to someone reading the code whether the argument is
>> interpreted as plaintext or HTML.  If you do
>> node.appendChild('<div>'), is that supposed to append a text node or
>> an element?  Separate methods named things like appendText or
>> insertTextBefore would be much clearer, and not much longer if at all.
> I don't think it is unreasonable to expect some knowledge here,
> especially as it is safe for the developer to do the wrong thing. I
> would have been opposed if the incorrect thing was unsafe which is the
> case where HTML markup is allowed.
>
> It is just as unclear to me with insertBefore. Insert what before
> what? Maybe we should rename that to insertChildNodeBeforeChildNode
> then?
>
> Sorry, I just think it is time to make things less verbose so the JS
> libraries can shrink.

Can you demonstrate how it allows js libs to shrink?
If they adopt this feature they will at least have to *add* feature 
detection.

Sean
Received on Monday, 3 October 2011 20:53:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:08 GMT