Closed Bug 313033 Opened 19 years ago Closed 19 years ago

E4X: XML objects can't access methods on XML.prototype, and overriding existing methods on XML.prototype causes problems

Categories

(Core :: JavaScript Engine, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 312196

People

(Reporter: stryker330, Unassigned)

Details

Attachments

(1 file)

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20051018
Firefox/1.4.1 ID:2005101805

I try defining a method on XML.prototype and XMLList.prototype as such:
XML.prototype.function::foo = XMLList.prototype.function::foo = function() {};

Attempting to invoke this method on an XML or XMLList object throws a "not
found" error:
var a = <root><section><subsection/></section></root>;
a.foo() // throws error
a.function::foo // returns undefined

When overriding an built-in method such as children() on XML/XMLList.prototype,
attempting to invoke this new method also throws an error (resulting in
accessing neither the new method nor the built-in method). For example:

XML.prototype.function::children = XMLList.prototype.function::children =
function() {};
a.children() // throws error
a.function::function // returns undefined
Attached file testcase
Forgot to mention that I'm not that familiar with E4X, and I'm not sure if this
bug is valid.
Summary: XML objects can't access methods on XML.prototype, and overriding existing methods on XML.prototype causes problems → E4X: XML objects can't access methods on XML.prototype, and overriding existing methods on XML.prototype causes problems
This is how E4X works, broken-as-designed.  In SpiderMonkey, you can use the
function:: namespace qualifier to get and set methods.

I believe this bug is a dup.

/be
Whiteboard: DUPEME
I AM using the function:: namespace.
Sorry!  This is a dup, still.  Followup fix patch still pending review in bug
312196, but the first patch already went into the trunk, and it fixes your testcase.

/be

*** This bug has been marked as a duplicate of 312196 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
Whiteboard: DUPEME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: