X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=jquery%2Fjquery.js;h=4ba40ff80c648dbc0d8713def70ff304c55f85c4;hb=414d059941343fa3c6bbbf40d3cb55cba4c4c85e;hp=95afaa5c674808f882091f32a65d117d068d534b;hpb=586e36867b9ee10be4102d64ef00f2b16b32fb08;p=jquery.git diff --git a/jquery/jquery.js b/jquery/jquery.js index 95afaa5..4ba40ff 100644 --- a/jquery/jquery.js +++ b/jquery/jquery.js @@ -17,6 +17,10 @@ window.undefined = window.undefined; * @constructor */ function jQuery(a,c) { + + // Make sure t hat a selection was provided + a = a || jQuery.context || document; + /* * Handle support for overriding other $() functions. Way too many libraries * provide this function to simply ignore it and overwrite it. @@ -35,9 +39,6 @@ function jQuery(a,c) { // Use the default method, in case it works some voodoo return jQuery._$( a ); - // Make sure t hat a selection was provided - a = a || jQuery.context || document; - // Watch for when a jQuery object is passed as the selector if ( a.jquery ) return a; @@ -51,7 +52,7 @@ function jQuery(a,c) { return new jQuery(a,c); // Watch for when an array is passed in - this.pushStack( a.constructor == Array ? + this.get( a.constructor == Array ? // Assume that it's an array of DOM Elements a : @@ -275,9 +276,9 @@ jQuery.fn = jQuery.prototype = { }, pushStack: function(a,args) { - var fn = args ? (args.constructor == Function ? args : args[args.length-1]) : function(){}; + var fn = args[args.length-1]; - if ( !fn ) { + if ( !fn || fn.constructor != Function ) { if ( !this.stack ) this.stack = []; this.stack.push( this.get() ); this.get( a );