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:
}
return this;可以让JQuery形成一个链式的使用结构。在jQuery对象中,this指向本身的jQuery对象。
w刚开始看也是这个疑问