jquery源码笔记

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

  

原文地址:https://www.cnblogs.com/labihua/p/4528651.html