views:

117

answers:

1

Why do I get a 1, then a 0 when this script runs in greasemonkey:

//jQuery source code.....

alert(jQuery('body').size());
(function(jQuery){
    var find = jQuery.find;

    jQuery.find = function(selector, context){
     return find(selector, context);
    };
})(jQuery);
alert(jQuery('body').size());
A: 

I think you are missing the this object when you call find. This says 1, then 1:

jQuery.find = function(selector, context){
    return find.apply(this, arguments);
};
John Kugelman