(function (window,undefiend) { //--------------------------jquery变量声明------------------------------------------------ var jQuery = function (selector,context) { return new jQuery.fn.init(selector,context); }, _jQuery = window.jQuery, _$ = window.$, document = window.document; //后面还有好多的变量 //---------------------------jqeury方法------------------------------------------------------- jQuery.fn = jQuery.prototype = { //给jQuery增加一个fn对象 init : function (selector, context) { var match,elem,ret,doc; }, //--------------------jquery对象访问------- selector:"", jquery:"1.4.2", //jquery版本号 length:0, each:function (callback,args) { return jQuery.each(this,callback,args); }, size:function () { return this.length; }, toArray:function () { return slice.call(this ,0); }, get:function (num) { return num == null ? this.toArray(): (num < 0 ? this.slice(num)[0] : this[num]); } }; jQuery.fn.init.prototype = jQuery.fn; //------------------------jquery插件开发--------- jQuery.extend = jQuery.fn.extend = function () { } })(window);
jquery源码分析初步
最新推荐文章于 2017-06-06 11:24:36 发布