jquery 源码剖析1

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

 

(function(){

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

 

jQuery=function(){

  return new jQuery.prototype.init();

}

    jQuery.init=function(){ } 

   jQuery.css=function(){}

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

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

 

jQuery().css();

posted on 2015-05-02 17:24  wf110  阅读(165)  评论(0编辑  收藏  举报