jQuery整体架构

(function(global, factory) {
    factory(global);
}(typeof window !== "undefined" ? window : this, function(window, noGlobal) {
    var jQuery = function( selector, context ) {
    //当使用jQuery()的时候这里还会执行啊。
return new jQuery.fn.init( selector, context ); }; jQuery.fn = jQuery.prototype = {}; // 核心方法 // 回调系统 // 异步队列 // 数据缓存 // 队列操作 // 选择器引 // 属性操作 // 节点遍历 // 文档处理 // 样式操作 // 属性操作 // 事件体系 // AJAX交互 // 动画引擎 return jQuery; }));

这就是单例模式。

http://www.cnblogs.com/darr/p/5085918.html

原文地址:https://www.cnblogs.com/darr/p/5103318.html