Status: New
Owner: ----
New issue 916 by dmerenne: Overloaded method in an Element are overridden
by the Element.prototype one
http://code.google.com/p/v8/issues/detail?id=916
Chrome Version:
Google Chrome 7.0.517.41 (Official Build 62167) beta
WebKit 534.7
V8 2.3.11.17
User Agent Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.7
(KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7
Command Line /usr/bin/google-chrome
Other browsers tested:
Firefox 3.x: OK
What steps will reproduce the problem?
1. extend the prototype of an html dom element with a function
2. overload the function in the dom element itself
3. call the function
What is the expected result?
The function defined at 2 should be called.
What happens instead?
The one defined at 1 is called instead.
Code to reproduce the problem:
var s = document.getElementById("test");
s.__proto__.getValue = function () { return "foo"; };
s.getValue = function () { return "bar" };
console.log(s.getValue());
From the ecmascript spec:
In other words, first the object mentioned directly is examined for such
a property; if that object contains the named property, that is the
property to which the reference refers; if that object does not contain the
named property, the prototype for that object is examined next; and so on.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev