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

RESOLVED DUPLICATE of bug 312196

Status

()

RESOLVED DUPLICATE of bug 312196
13 years ago
13 years ago

People

(Reporter: stryker330, Unassigned)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

13 years ago
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
(Reporter)

Comment 1

13 years ago
Created attachment 200103 [details]
testcase

Forgot to mention that I'm not that familiar with E4X, and I'm not sure if this
bug is valid.
(Reporter)

Updated

13 years ago
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
(Reporter)

Comment 3

13 years ago
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
Last Resolved: 13 years ago
Resolution: --- → DUPLICATE
Whiteboard: DUPEME
You need to log in before you can comment on or make changes to this bug.