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 18:00:55 -0500
To: Ian Hickson <ian@hixie.ch>
Cc: WWW DOM <www-dom@w3.org>
Message-Id: <1073343654.28170.224.camel@jfouffa.w3.org>

On Mon, 2004-01-05 at 16:32, Ian Hickson wrote:
> [...]
> I am confused. What exactly does Xerces do?

It "works". In other words, it will remove the child, and insert it
again, with all the appropriate events.

> The spec says:
> # If the newChild is already in the tree, it is first removed.
> I interpreted "first" as meaning that was the initial step of the
> algorithm.

The "first" was necessary in order to specify the order of the events
that are generated underneath, not as a way to specify an algorithm.

> [...]
> What's the use case for doing what the spec currently says?

The use case for not changing the current behavior without breaking
existing implementation is simple: as Joe mentioned, this is a DOM Level
1 erratum and we don't modifying DOM Level 1 unless a really good
reason. node.insertBefore(child, child) was already discussed in January
2001 by the DOM WG. We did contact some implementers at that time. 2
implementations were known to do a no-op, 2 or 3 were considering the
case valid (i.e. it "works"), 1 was raising an exception. We declared
the first 2 and the last one invalid according to the specification and
didn't change anything. With your number and an update, we now have 4
implementations doing nothing, 3 or 4 considering the case valid (it
"works"). The WG is now rendering the case "implementation dependent".
It is better imho that the previous status quo (and will avoid dealing
with this case in 2006 :).


Note to myself: the FAQ needs to be updated to match this
"implementation dependent" behavior

[1] http://www.w3.org/DOM/faq.html#insertBeforeSelf
Received on Monday, 5 January 2004 18:00:57 UTC

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