首页 > 技术文章 > jquery 源码剖析1

friends-wf 2015-05-02 17:24 原文

()();   闭包,让声明的变量变成局部变量,使外部无法访问,防止和其他代码冲突,互不影响。

 

(function(){

})();              和一般执行方法一样的。

 

jQuery=function(){

  return new jQuery.prototype.init();

}

    jQuery.init=function(){ } 

   jQuery.css=function(){}

//这句是重点 使得下面 jQuery() 返回的 具有 原型css方法

 jQuery.prototype.init.prototype=jQuery.prototype;

 

jQuery().css();

推荐阅读