#《jQuery 技术内幕》读书笔记(2)—— 第2章 构造函数 jQuery() 和 jQuery.fn.init ()
注意:代码部分来自 jquery 1.12.4
1.构造函数 jQuery()
2.总体结构
// 当 jQuery 初始化时,里面的代码被执行
(function( global, factory ) {
if ( typeof module === "object" && typeof module.exports === "object" ) {
/*
For CommonJS and CommonJS-like environments where a proper `window`
is present, execute the factory and get jQuery.
For environments that do not have a `window` with a `document`
(such as Node.js), expose a factory as module.exports.
This accentuates the need for the creation of a real `window`.
e.g. var jQuery = require("jquery")(window);
See ticket #14549 for more info.
*/
module.exports = global.document ?
factory( global, true ) :
function( w