Closed Bug 277767 Opened 20 years ago Closed 18 years ago

parent() of XML object yields undefined but should be null if no parent exists

Categories

(Rhino Graveyard :: E4X, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: martin.honnen, Unassigned)

References

Details

Section 9.1.1 Internal Properties and Methods of the E4X specifications says
about the [[Parent]] property:
  "The value of the [[Parent]] property must be either an XML object or null."
The method parent of an XML object maps directly to that internal property as
the specifications says:
  "When the parent method is called on an XML object x, the following step is taken:
!!!1. Return x.[[Parent]]"
thus I think if an XML object has no parent then Rhino should return null when
calling object.parent().
Rhino (Rhino 1.6 release 1 2004 11 30) however returns undefined which is a bug.

Test case to be run in the Rhino shell:

var xhtml = <html xmlns="http://www.w3.org/1999/xhtml"></html>;
'xhtml.parent() === null: ' + (xhtml.parent() === null) + '\r\n' +
'xhtml.parent() === undefined: ' + (xhtml.parent() === undefined)

yields 

xhtml.parent() === null: false
xhtml.parent() === undefined: true

but should yield

xhtml.parent() === null: true
xhtml.parent() === undefined: false
Reassigning to please_see_bug_288433@eml.cc pending resolution of bug 288433
Assignee: igor.bukanov → please_see_bug_288433
Assignee: please_see_bug_288433 → nobody
This bug is fixed in the coming DOM-only E4X implementation.  See bug 
Status: NEW → ASSIGNED
Depends on: 355677
See bug 355677, I mean (sorry, typo). :)
See test e4x/XML/13.4.4.11.js section 2.  Rhino now passes this test if XMLBeans is not present.  See bug 355677.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Adding target milestone of 1.6R6 based on the date this bug was resolved FIXED.
Target Milestone: --- → 1.6R6
You need to log in before you can comment on or make changes to this bug.