Subj : Re: E4X: result of parent() method call on XMLList To : netscape.public.mozilla.jseng From : Martin Honnen Date : Sun Apr 17 2005 02:44 pm Brendan Eich wrote: > Anyway, why do you say the spec mandates undefined? Here is the > XMLList.prototype.parent algorithm in full: > > 1. If l.[[Length]] = 0, return undefined > 2. Let parent = l[0].[[Parent]] > 3. For i = 1 to l.[[Length]]-1, if l[i].[[Parent]] is not equal to > parent, return undefined > 4. Return parent > > Note that both elements have null as parent, so step 4 will return > parent, which is l[0].[[Parent]] or null. > > Somone please file a Rhino bug. I think Rhino even does the right thing as far as that algorithm for parent on XMLList goes but Rhino has bug meaning all those parentless XML objects in the example var godList = <>KiboXibo; have parent as undefined in Rhino and thus the parent() call on the list yields undefined too. Bob, is there a test case in the suite already covering the check that Kibo.parent() should yield null? -- Martin Honnen http://JavaScript.FAQTs.com/ .