Closed
Bug 313033
Opened 20 years ago
Closed 20 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)
Tracking
()
RESOLVED
DUPLICATE
of bug 312196
People
(Reporter: stryker330, Unassigned)
Details
Attachments
(1 file)
|
1.14 KB,
text/html
|
Details |
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•20 years ago
|
||
Forgot to mention that I'm not that familiar with E4X, and I'm not sure if this
bug is valid.
| Reporter | ||
Updated•20 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
Comment 2•20 years ago
|
||
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•20 years ago
|
||
I AM using the function:: namespace.
Comment 4•20 years ago
|
||
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: 20 years ago
Resolution: --- → DUPLICATE
Whiteboard: DUPEME
You need to log in
before you can comment on or make changes to this bug.
Description
•