jquery源码笔记
2015-05-25 19:19 厘澄 阅读(133) 评论(0) 收藏 举报1、jquery初始化
function jQuery() {
return new jQuery.prototype.init();
}
jQuery.prototype.init = function () {}
jQuery.prototype.css = function () {}
为啥链式运动可以直接调用呢?
jquer().css()
是因为
jquery增加了这一句:
function jQuery() {
return new jQuery.prototype.init();
}
jQuery.prototype.init = function () {}
jQuery.prototype.css = function () {}
jQuery.ptotype.init.prototype = jQuery.prototype;
这样init的prototype就引用了jQuery.prototype
浙公网安备 33010602011771号