01.阅读JQUERY源码——定义函数
2016-03-14 22:50
661 查看
(function(window,undefined){ var rootjQuery, readyList, core_strundefined =typeof undefined, location =window.location, document =window.document, docElem =window.documentElement, _jQuery =window.jQuery, _$ = window.$, class2type = {}, //无用了 core_deletedIds = [], core_version = "2.0.3", //Save a reference to some core metheds core_concat =core_deletedIds.concat, core_push=core_deletedIds.push, core_slice =core_deletedIds.slice, core_indexOf =core_deletedIds.indexOf, core_toString = class2type.hasOwnProperty, core_trim =core_version.trim, //定义jQ函数 jQuery = function(selector,context){ return new jQuery.fn.init(selector,context,rootjQuery); }, //正则 暂缺 })(window) /*————————————解析————————————————————————————*/ /*传window*/ 1/速度更快 2/传参e取代window(压缩版) /*传undefined*/ 1/防止undefined被修改 /*严格模式下需要规范,否则会报错*/ "use strict" /*不充分判断(IE9以下)*/ window.a == undefined /*全兼容判断*/ typeof window.a == undefined /*jQuery的对象设计方式*/ jQuery.fn=jQuery.prototype; function jQuery(){ return new jQuery.prototype.init(); } jQuery.prototype.init =function(){} jQuery.prototype.css =function(){} jQuery.prototype.init.prototype = jQuery.prototype; jQuery().css(); /*———————————————————————————————————————————————*/
相关文章推荐
- jQuery 关于 end() 方法的详细解释
- 00.阅读JQUERY源码——简目录
- Jquery页面滚动
- jQuery 中 children() 与 find() 用法的区别
- Jquery动态绑定事件
- jQuery省市区三级联动插件
- jquerymobile动态添加元素之后
- Jquery validate配置项
- jQuery resize() 和 scroll() 的优化
- 【深入浅出jQuery】源码浅析--整体架构
- 汤姆大叔的博客 JS/jQuery
- jQuery1.9+中删除了live以后的替代方法
- jQuery插件开发
- jQuery选择器总结
- jquery中构造对象的核心
- jQuery 插件为什么要return this.each()
- JQuery:选择器、动画、AJAX请求
- jquery如何获取一个select里面的所有option的值
- jquery知识小结
- Jquery 之DOM文档操作(一)