知识&工具

导航

jquery框架研究

上代码

var $ = jQuery = function() {
    return new jQuery.fn.init();
};


jQuery.fn = jQuery.prototype = {
    init: function(args) {
        this.length = 0;  //修改length
        this.test = function() { //添加test方法
            return this.length;
        };
        delete this.jquery;  //删除jquery属性
         
        return this;  //指向jQuery实例     
    },
    jquery: '1.3.2',
    length: 1,
    size: function() {
        return this.length;
    }
};
jQuery.fn.init.prototype=jQuery.prototype;

posted on 2012-08-21 22:31  康乐sty  阅读(106)  评论(0编辑  收藏  举报