jquery源码分析初步

来源:互联网 发布:vpn代理软件破解版 编辑:程序博客网 时间:2024/05/21 06:19
(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);
0 0