W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2004

Re: node.insertBefore(child, child)

From: Philippe Le Hegaret <plh@w3.org>
Date: Mon, 05 Jan 2004 14:00:04 -0500
To: Ian Hickson <ian@hixie.ch>
Cc: WWW DOM <www-dom@w3.org>
Message-Id: <1073329203.28169.17.camel@jfouffa.w3.org>

On Fri, 2003-11-28 at 11:55, 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?

It is indeed the behavior of common UAs, but unfortunately, it is not
the case on Xerces. Given that at least one significant implementation
is following the specification, we cannot render it non conformant by
modifying the specification to accomodate and describe the behaviors of
the UA implementations. node.insertBefore(child, child) and
node.replaceChild(child, child) are now described as "implementation
dependent" in the specification. It does not clarify anything except
that DOM applications should now be aware of no interoperability for
those cases.

Let us know if this decision satisfies or not your request,

Philippe
Received on Monday, 5 January 2004 14:03:16 GMT

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