Has anyone noticed some problems with $.extend()-ing prototype, and
attempting to override existing methods?

Take this example:

var MyObj = function() {};

$.extend(MyObj.prototype, {
        toString: function() { return 'Hello'; }
});

var obj = new MyObj();
console.log(obj.toString());

In Firefox, and other browsers, we get: 'Hello'
In IE (6), we get: '[object Object]'

But, we can extend MyObj.prototype in IE these ways:

MyObj.prototype.toString = ...
or,
MyObj.prototype['toString'] = ...
or,
MyObj.prototype = {
    toString: ...
};

all work in IE!

Any ideas why $.extend doesn't work?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to