這個(gè)問題大家看看吧
init:?function(selector)?{ this.selector?=?selector; return?this; }, 為什么要return?this呢? 這是jquery源碼里的問題
var $$ = ajQuery = function(selector) {
? ? return new ajQuery.fn.init(selector);
}
ajQuery.fn = ajQuery.prototype = {
init:?
}
init:?function(selector)?{ this.selector?=?selector; return?this; }, 為什么要return?this呢? 這是jquery源碼里的問題
var $$ = ajQuery = function(selector) {
? ? return new ajQuery.fn.init(selector);
}
ajQuery.fn = ajQuery.prototype = {
init:?
}
2016-08-09
舉報(bào)
2016-08-16
return this;可以讓JQuery形成一個(gè)鏈?zhǔn)降氖褂媒Y(jié)構(gòu)。在jQuery對(duì)象中,this指向本身的jQuery對(duì)象。
2018-11-12
w剛開始看也是這個(gè)疑問