然后
ajQuery.prototype.init.prototype = ajQuery.prototype;
//得到選擇器名字
var m = $$('aaa');
alert(m.selectorName()) ;
ajQuery.prototype.init.prototype = ajQuery.prototype;
//得到選擇器名字
var m = $$('aaa');
alert(m.selectorName()) ;
2015-03-05
那個fn就是個別名,也可以這樣寫
var $$ = ajQuery = function(selector) {
return new ajQuery.prototype.init(selector);
}
ajQuery.prototype = {
init:function(selector){
this.selector = selector;
},
selectorName:function(){
return this.selector;
},
constructor: ajQuery
}
var $$ = ajQuery = function(selector) {
return new ajQuery.prototype.init(selector);
}
ajQuery.prototype = {
init:function(selector){
this.selector = selector;
},
selectorName:function(){
return this.selector;
},
constructor: ajQuery
}
2015-03-05
不知道這個是哪個版本的源碼
我看1.7.2的源碼 doScrollCheck()這部分自調(diào)用函數(shù) 已經(jīng)拖出去了
我看1.7.2的源碼 doScrollCheck()這部分自調(diào)用函數(shù) 已經(jīng)拖出去了
2015-03-04
$$('aaron')是ajQuery.prototype.init的實例化對象,
如果init的prototype沒有關(guān)聯(lián)ajQuery.prototype,他也就沒有name屬性,
當ajQuery.prototype.init.prototype = ajQuery.prototype后,
$$('aaron')就具有了ajQuery.prototype所有的屬性和方法,即實例方法共用了靜態(tài)方法
如果init的prototype沒有關(guān)聯(lián)ajQuery.prototype,他也就沒有name屬性,
當ajQuery.prototype.init.prototype = ajQuery.prototype后,
$$('aaron')就具有了ajQuery.prototype所有的屬性和方法,即實例方法共用了靜態(tài)方法
2015-03-02