Subj : E4X: calling appendChild method with existing child as the argument
To : netscape.public.mozilla.jseng
From : Martin Honnen
Date : Fri Apr 08 2005 04:07 pm
In E4X XML objects have a method called appendChild which behaves
differently in regardance to object identity when the method is called
with an existing child as the argument:
Spidermonkey:
js> var gods = KiboXibo;
js> gods
Kibo
Xibo
js> gods.appendChild(gods.god[0])
Kibo
Xibo
Kibo
js> gods.god[0] === gods.god[2]
true
so here after the appendChild the XML objects has two identical child
elements at different positions.
Compare to Rhino 1.6 release 1 2004 11 30
js> var gods = KiboXibo;
js> gods
Kibo
Xibo
js> gods.appendChild(gods.god[0])
Kibo
Xibo
Kibo
js> gods.god[0] === gods.god[2]
false
Which behaviour is right, Spidermonkey's or Rhino's?
--
Martin Honnen
http://JavaScript.FAQTs.com/
.