然后
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沒有關聯(lián)ajQuery.prototype,他也就沒有name屬性,
當ajQuery.prototype.init.prototype = ajQuery.prototype后,
$$('aaron')就具有了ajQuery.prototype所有的屬性和方法,即實例方法共用了靜態(tài)方法
如果init的prototype沒有關聯(lián)ajQuery.prototype,他也就沒有name屬性,
當ajQuery.prototype.init.prototype = ajQuery.prototype后,
$$('aaron')就具有了ajQuery.prototype所有的屬性和方法,即實例方法共用了靜態(tài)方法
2015-03-02
類數(shù)組對象就是類似一個數(shù)組的對象,對象默認是沒有l(wèi)ength屬性的,所以
1,必須構(gòu)造一個length屬性。
2,必須有下標0,1,2...n(必須連續(xù)遞增,不能是0,3,4)
3,且length <= (n+1)
起始下標就是對象的屬性,這個屬性在對象里通過this[i]使用
jQuery()的結(jié)果就存儲在this[i]里,get(i)相當于調(diào)用了this[i]
1,必須構(gòu)造一個length屬性。
2,必須有下標0,1,2...n(必須連續(xù)遞增,不能是0,3,4)
3,且length <= (n+1)
起始下標就是對象的屬性,這個屬性在對象里通過this[i]使用
jQuery()的結(jié)果就存儲在this[i]里,get(i)相當于調(diào)用了this[i]
2015-02-17