jQuery = window.jQuery = window.$ = function( selector, context ) {

return new jQuery.fn.init( selector, context );
}
         .
         .
         .
jQuery.fn = jQuery.prototype = {
init: function( selector, context ) {
         ......
         }
    其中 jQuery.fn =jQuery.prototype={...}  对这个地方不是很明白,{...}到底作为jQuery的原型对象、还是jQuery.fn的原型对象?    求解

解决方案 »

  1.   

    = 是赋值运算符,是从右到左执行!jQuery.fn = jQuery.prototype = {
        init: function( selector, context ) {
             ......
             }首先执行:
    jQuery.prototype = {
        init: function( selector, context ) {
             ......
             }然后:jQuery.fn = jQuery.prototype
      

  2.   

    连赋值var i = j = 3;
      

  3.   

    老胡,=号是赋值  我懂,不懂的是,jQuery.prototype = {...}  先将对象赋值给jQuery原型又jQuery.fn = jQuery.prototype   能解释清晰点吗
      

  4.   

    老胡,=号是赋值  我懂,不懂的是,jQuery.prototype = {...}  先将对象赋值给jQuery原型又jQuery.fn = jQuery.prototype   能解释清晰点吗
      

  5.   

    jQuery.fn与jQuery.prototype都是jQuery对象的属性。
    只是prototype是我们所说的原型对象。而fn是我们定义的一个普通属性。
    这样以来他们等价了
      

  6.   

    不懂的是,jQuery.prototype = {...} 先将对象赋值给jQuery原型又jQuery.fn = jQuery.prototype 能解释清晰点吗这样,不就 可以用 jQuery.fn 代替  jQuery.prototype 了吗?
    他们2个就是一个东西了!要扩展jquery 方法,直接
    $.fn.XXXX  就可以了!因为:$=jQuery ==>
    $.fn = jQuery.fn 
     
    因为:jQuery.fn = jQuery.prototype ==>
    $.fn=jQuery.prototype==》
    $.fn.XXXX 相当于  jQuery.prototype.XXXX
      

  7.   

    常健同志,我可以这样理解吗?jQuery.prototype={...},把对象赋值给jQuery原型对象jQuery.fn=jQuery.prototype,fn属性保存的是原型对象的指针<div id='div1'></div>
    <div id='div2'></div>$("#div1"),$("#div2")  每次查询对象时、调用init函数,而原型对象下的方法是共享的!!!!
      

  8.   

    jQuery.fn =jQuery.prototype={...},{...}既是jQuery原型的对象,也是jQuery.fn的对象。使用fn我自己理解是为了实现不同的名称空间。
      

  9.   

    LZ看到的是哪个版本的jQuery?最新的1.4.4看起来感觉更容易理解。
      

  10.   

    jquery 是window对象的一个属性 $也是window对象的一个属性 它们指向是同一个函数,也就是成为了一个window对象的方法 ,并且返回一个对象
      
      jquery 与 widnow.jquery()  window.$()指向的是同一个对象
    jQuery.fn = jQuery.prototype = {
        init: function( selector, context ) {
             ......
             }
    jquery.fn jquery.prototype 指向的也是同一个对象
      并且此对象具有一个init方法但是prototype仅仅只是jquery对象的一个属性 与fn一样 是个指针并非javascript构造函数的属性 prototype对象
    在这里好像也不是为类添加一个成员个人理解///  
      

  11.   

     也就是可以 使用   jqeury() 与 $() 来获对象
     并返回一个节点列表/////
      

  12.   


       function $(){    var elements=[];
        for(var i=0;i<arguments.length;i++){
            var element=arguments[i];
            if(typeof element=='string')
               element=document.getElementById(element);
            if(arguments.length==1)
              return element;
            elements.push(element);
         }
     
            return elements;    }这个prototype 框架 这个格式工厂函数 还是比较好!!!!