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

Re: modifying the DOM WAS: Node append

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Mon, 03 Oct 2011 17:39:30 -0400
Message-ID: <4E8A2B92.5090007@mit.edu>
To: Ojan Vafai <ojan@chromium.org>
CC: Anne van Kesteren <annevk@opera.com>, Aryeh Gregor <ayg@aryeh.name>, Erik Arvidsson <arv@chromium.org>, Olli@pettay.fi, Robin Berjon <robin@berjon.com>, www-dom@w3.org, Alex Russell <slightlyoff@chromium.org>
On 10/3/11 5:30 PM, Ojan Vafai wrote:
> Specifically, lets add the following methods to Node:
> prepend(nodeish) - Adds to the start of the node.
> append(nodeish) - Adds to the end of the node.
> before(nodeish) - Adds before the node.
> after(nodeish) - Adds after the node.
> replace(nodeish) - Replaces the node.
> remove() - Removes the node.

No matter what else, we _have_ to do the remove thing! 
foo.parentNode.removeChild(foo) is just .... <sigh>.

The only worry with adding these is on* attributes that might happen to 
use those barewords and expect to hit global scope.  Do we have any data 
on such things?  (Note that we've had problems with that sort of thing 
in the past, e.g. when inputs grew a 'list' property.)

> 1. node, string, array, nodelist
> 2. node, string, array, nodelist, number, bool, undefined, null
> 3. node, string, anything with a length property is treated as an array,
> anything else is toString'ed.

And for option 2 anything else throws?

Note that in webidl terms, "array", "nodelist", and "anything with a 
length property" are sort of the same thing last I checked....

Received on Monday, 3 October 2011 21:40:08 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:36:59 UTC