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

node.insertBefore(child, child)

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 28 Nov 2003 16:55:42 +0000 (UTC)
To: www-dom@w3.org
Message-ID: <Pine.LNX.4.58.0311281644060.2576@dhalsim.dreamhost.com>

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:


...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?

-- References --
[1] http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-952280727

Ian Hickson                                      )\._.,--....,'``.    fL
U+1047E                                         /,   _.. \   _\  ;`._ ,.
http://index.hixie.ch/                         `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 28 November 2003 11:55:50 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:11 UTC