JQuery文件的开头代码:
!function(d, c) {
"object" == typeof module && "object" == typeof module.exports ? module.exports = d.document ? c(d, !0) : function(b) {
if (!b.document) {
throw new Error("jQuery requires a window with a document")
}
return c(b)
} : c(d)
}("undefined" != typeof window ? window : this, function(a, b) {
。。。。。。。
});
以上一段代码是自执行代码结构,等价于:
function AAAA(a, b) {
"object" == typeof module && "object" == typeof module.exports ? module.exports = a.document ? b(a, !0) : function(a) {
if (!a.document) throw new Error("jQuery requires a window with a document");
return b(a)
}: b(a)
}
function BBB(a, b) {
。。。
}
var paramA="undefined" != typeof window ? window: this;
AAAA(paramA,BBB);