使用 JQuery 时,扩展具有覆盖 toString() 函数的对象会导致 Firefox 中出现“不支持操作”错误。但是在 Chrome 中它工作正常。这是 JQuery 中的错误还是我在下面的代码片段中做错了什么?
var foo = function () {
var that = this;
that.toString = function () { return "foobar" };
return that;
}();
var foo2 = function () {
var that = this;
that = $.extend(true, {}, foo); // copy = options[ name ]; = "Operation is not supported" in Firefox 3.6.8
return that;
} ();
alert(foo.toString()); //"foobar" in Chrome
alert(foo2.toString()); //"foobar" in Chrome
jQuery 版本 1.4.2
非常感谢,
戈德斯