(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源碼分析初步
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.