* @constructor
*/
function jQuery(a,c) {
+
+ // Shortcut for document ready (because $(document).each() is silly)
+ if ( a && a.constructor == Function )
+ return $(document).ready(a);
+
+ // 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.
// 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;
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 :
},
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 );