什么版本的jquery哦。。jqeury.fn没有jquery属性吧。。jQuery.fn = jQuery.prototype = {
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem, ret, doc;
console.log(this)    输出[], init构造中 this是选择的对象集合
//....

解决方案 »

  1.   


    版本1.9.1
    我也知道jquery.fn没有jquery属性,但是的的确确指向了这个~
      

  2.   


    jQuery.fn = jQuery.prototype = {
    constructor: jQuery,
    init: function( selector, context, rootjQuery ) {
    var match, elem, ret, doc;
    console.log( this instanceof jQuery );   // return true 
                    console.log( this instanceof Object );   // return true
    // Handle $(""), $(null), $(undefined), $(false)
      

  3.   


    版本1.9.1
    我也知道jquery.fn没有jquery属性,但是的的确确指向了这个~你怎么知道this指向jquery.fn.jquery.init[0]?jQuery.fn.jquery是jquery的版本,string类型
      

  4.   


    版本1.9.1
    我也知道jquery.fn没有jquery属性,但是的的确确指向了这个~你怎么知道this指向jquery.fn.jquery.init[0]?jQuery.fn.jquery是jquery的版本,string类型
    你怎么知道this指向jquery.fn.jquery.init[0]?
    -->Chrome单步调试看到的~
    好吧 我写的时候没注意大小写,jQuery.fn.jquery是jQuery的版本不假,它显示的是jQuery.fn.jQuery.init[0]
      

  5.   

    我用firebug,显示为[],到是没注意chrome指向jQuery.fn.jQuery.init[0],这就晓不得调试工具怎么指向引用的了。。实际并没有jQuery.fn.jQuery这个属性。。
      

  6.   

    是的。实际并没有jQuery.fn.jQuery这个属性。
    版主大人,您别滴汗啊。。还得看您的呢,都没其他人回复我靠~~~其实我想的很简单,init是jQuery.fn的函数,那么这个this就应该指向jQuery.fn的才对。。
    前面看到 new jQuery.fn.init( selector, context, rootjQuery ); 我又觉得应该就是指向init。。
    本来就有点迷糊了,这个调试工具一调就更浆糊了~
      

  7.   

    自己回答一下,
    原因很简单, 在fn的最后面, 有这么三行代码:
    jQuery.fn = jQuery.prototype = {
    // For internal use only.
    // Behaves like an Array's method, not like a jQuery method.
    push: core_push,
    sort: [].sort,
    splice: [].splice
    };
    jq对象本身是个Object,添加了Array的专有方法后,就变得像数组了,看上去就是Object[length],多么像数组啊!!!
    嗯。。就是这么回事。
    That's all.