// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// Strict HTML recognition (#11290: must start with <)
- // Shortcut simple #id case for speed
- rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
+ rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
init = jQuery.fn.init = function( selector, context, root ) {
var match, elem;
assert.expect( expected );
// Basic constructor's behavior
- assert.equal( jQuery().length, 0, "jQuery() === jQuery([])" );
- assert.equal( jQuery( undefined ).length, 0, "jQuery(undefined) === jQuery([])" );
- assert.equal( jQuery( null ).length, 0, "jQuery(null) === jQuery([])" );
- assert.equal( jQuery( "" ).length, 0, "jQuery('') === jQuery([])" );
- assert.deepEqual( jQuery( obj ).get(), obj.get(), "jQuery(jQueryObj) == jQueryObj" );
-
- // Invalid #id goes to Sizzle which will throw an error (gh-1682)
- try {
- jQuery( "#" );
- } catch ( e ) {
- assert.ok( true, "Threw an error on #id with no id" );
- }
+ equal( jQuery().length, 0, "jQuery() === jQuery([])" );
+ equal( jQuery(undefined).length, 0, "jQuery(undefined) === jQuery([])" );
+ equal( jQuery(null).length, 0, "jQuery(null) === jQuery([])" );
+ equal( jQuery("").length, 0, "jQuery('') === jQuery([])" );
+ equal( jQuery("#").length, 0, "jQuery('#') === jQuery([])" );
// can actually yield more than one, when iframes are included, the window is an array as well
assert.equal( jQuery( window ).length, 1, "Correct number of elements generated for jQuery(window)" );