我觉得可以啊
2016-08-09 21:41
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刚开始看也是这个疑问
jQuery源码解析(架构与依赖模块)
84050 学习 · 290 问题
相似问题