我正在尝试以下操作:
var Class1 = function() {}
Class1.prototype = {
MyMethod: function() { /* Do Stuff */ }
}
var Class2 = function() {}
Class2.prototype = {
AnotherMethod: function() { /* Do More Sweet Stuff */ }
}
jquery.extend(true, Class1, Class2);
我现在应该期望能够执行以下操作:
var c = new Class1();
c.AnotherMethod();
在 Firefox 3.6 中,这工作得很好。在 Internet Explorer 7 和 8 中,它显示“对象不支持此属性或方法”。
我误解了 $.extend 应该如何工作,还是 IE 表现不佳?
jQuery 版本:1.3.2
谢谢!