(function() {
function F() {}
F.prototype = QUnit;
QUnit = new F();
// Make F QUnit's constructor so that we can add to the prototype later
QUnit.constructor = F;
}());
我不明白 :)
(function() {
function F() {}
F.prototype = QUnit;
QUnit = new F();
// Make F QUnit's constructor so that we can add to the prototype later
QUnit.constructor = F;
}());
我不明白 :)
简而言之,这会将 QUnit 全局引用更改为使用原型继承来扩展原始 QUnit 对象的新对象。这样您就可以在不破坏原始对象的情况下扩展/更改 QUnit。检查此以获取更多详细信息:http: //javascript.crockford.com/prototypal.html