Switched jQuery() to represent jQuery([]) instead of jQuery(document).

This commit is contained in:
John Resig 2009-12-09 20:36:07 -08:00
parent b846ad4ca0
commit 04524287d3
2 changed files with 2 additions and 4 deletions

View File

@ -1,9 +1,7 @@
// Define a local copy of jQuery // Define a local copy of jQuery
var jQuery = function( selector, context ) { var jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced' // The jQuery object is actually just the init constructor 'enhanced'
return arguments.length === 0 ? return new jQuery.fn.init( selector, context );
rootjQuery :
new jQuery.fn.init( selector, context );
}, },
// Map over jQuery in case of overwrite // Map over jQuery in case of overwrite

View File

@ -16,7 +16,7 @@ test("jQuery()", function() {
// Basic constructor's behavior // Basic constructor's behavior
equals( jQuery().length, 1, "jQuery() === jQuery(document)" ); equals( jQuery().length, 0, "jQuery() === jQuery([])" );
equals( jQuery(undefined).length, 0, "jQuery(undefined) === jQuery([])" ); equals( jQuery(undefined).length, 0, "jQuery(undefined) === jQuery([])" );
equals( jQuery(null).length, 0, "jQuery(null) === jQuery([])" ); equals( jQuery(null).length, 0, "jQuery(null) === jQuery([])" );
equals( jQuery("").length, 0, "jQuery('') === jQuery([])" ); equals( jQuery("").length, 0, "jQuery('') === jQuery([])" );