Closed Bug 313949 Opened 19 years ago Closed 19 years ago

E4X Edition 2 changes XML.prototype.child

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: brendan, Unassigned)

Details

Attachments

(1 file)

so that it always returns an XML list.  The new semantics are:

When the child method of an XML object x is called, it performs the following step:

1. If ToString(ToUint32(propertyName)) == propertyName
  a. Let children be the result of calling the [[Get]] method of x with argument "*"
  b. Let temporary be the result of calling the [[Get]] method of children with argument propertyName
c.If temporary is undefined, let temporary = new XMLList()
d.return temporary
2.Let temporary be the result of calling the [[Get]] method of x with argument propertyName
3.Return ToXMLList(temporary)

Patch coming up.  This is so new, and so late in 1.8, that I don't propose to fix it for 1.8/fx1.5/js1.6.

/be
Attachment #200936 - Flags: review?(mrbkap)
Comment on attachment 200936 [details] [diff] [review]
fix, plus common subroutine

>Index: jsxml.c
>+    /* ECMA-357 Edition 2 13.3.4.6 (note 13.3, not 13.4 as in Edition 2. */

Nit: Missing ')' in the comment.

r=mrbkap
Attachment #200936 - Flags: review?(mrbkap) → review+
Thanks, I closed that paren!

Fixed on trunk.  Thanks,

/be
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
ECMA 357 1st Edition says in the overview to 11.3.2 The typeof Operator: <Q>When UnaryExpression evaluates to a value of type XMLList, the typeof operator returns the string "xmllist".</Q>, but in the conversion table it says typeof XMLList is "xml" which is what our test for 11.3.2 uses. Which part is the typo? Without this to distinguish the two cases, how can I develop a test for this bug?
The spec is wrong to say typeof ever returns "xmllist", and this was answered in n.p.m.jseng.  It's fixed in the ISO version.

/be
(In reply to comment #5)
ok.
1) how can you distinguish XML from XMLList?
2) where is the ISO version?
(In reply to comment #6)
> (In reply to comment #5)
> ok.
> 1) how can you distinguish XML from XMLList?

You can't easily.  The late-breaking intention of the E4X designers was to unify XML and XMLList, but they didn't have time before ECMA-357 was due to be marked "done" -- too bad, but the spec had lots of more serious problems.  Unifying XML and XMLList will break backward compatibility, but that's probably a good thing.

> 2) where is the ISO version?

I can't find it.  I'll ping TG1 colleagues and comment again when I hear back.

/be
Flags: testcase-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: