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

Re: node.insertBefore(child, child)

From: Daniel Glazman <danielglazman@easyconnect.fr>
Date: Fri, 28 Nov 2003 18:06:01 +0100
Message-ID: <3FC78079.4030301@easyconnect.fr>
To: www-dom@w3.org

Ian Hickson wrote:

> Does the spec define what should happen with
> 
>    node.insertBefore(child, child)
> 
> ...?
> 
>>From my reading of the spec [1], what should happen is that first the
> child node should be removed ("If the newChild is already in the tree, it
> is first removed."), then a "NOT_FOUND_ERR" exception should be thrown,
> since the node is no longer in the tree and so can't be found.
> 
> This isn't useful, and isn't what UAs appear to have implemented. Based on
> this testcase:
> 
>    http://hixie.ch/tests/adhoc/dom/core/007-demo.html
> 
> ...Opera, Mozilla, IE6, and Safari all simply ignore the call, not
> changing the DOM and not raising any exceptions.
> 
> Could the spec be clarified to specify this interoperable behaviour?

I understand perfectly the reasons behind your proposal but I hate thinking
of a spec allowing the concept "insert that before itself" without complaining
about an illegal request. After all, it does not mean "do nothing", it really
_means_ nothing at all. It's conceptually non-sense.

</Daniel>
Received on Friday, 28 November 2003 12:07:47 GMT

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