Jquery內部結構圖

image.png
(function(window) {
// jQuery 變量,用閉包避免環(huán)境污染
var jQuery = (function() {
var jQuery = function(selector, context) {
return new jQuery.fn.init(selector, context, rootjQuery);
};
// 一些變量聲明
jQuery.fn = jQuery.prototype = {
constructor: jQuery,
init: function(selector, context, rootjQuery) {
}
// 原型方法
};
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {};//jQuery的擴展方法
jQuery.extend({
// 一堆靜態(tài)屬性和方法
// 用 extend 綁定,而不是直接在 jQuery 上寫
});
return jQuery;
})();
// 工具方法 Utilities
// 回調函數列表 Callbacks Object
// 異步隊列 Defferred Object
// 瀏覽器功能測試 Support
// 數據緩存 Data
// 隊列 Queue
// 屬性操作 Attributes
// 事件系統 Events
// 選擇器 Sizzle
// DOM遍歷 Traversing
// 樣式操作 CSS(計算樣式、內聯樣式)
// 異步請求 Ajax
// 動畫 Effects
// 坐標 Offset、尺寸 Dimensions
window.jQuery = window.$ = jQuery;
})(window);