aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core.js3
-rw-r--r--test/unit/core.js3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/core.js b/src/core.js
index 0211808c5..fcbd1c358 100644
--- a/src/core.js
+++ b/src/core.js
@@ -17,7 +17,8 @@ var jQuery = function( selector, context ) {
// A simple way to check for HTML strings or ID strings
// (both of which we optimize for)
- quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
+ quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
+
// Is it a simple selector
isSimple = /^.[^:#\[\.,]*$/,
diff --git a/test/unit/core.js b/test/unit/core.js
index 9367ab10d..2563f17cb 100644
--- a/test/unit/core.js
+++ b/test/unit/core.js
@@ -12,7 +12,7 @@ test("Basic requirements", function() {
});
test("jQuery()", function() {
- expect(24);
+ expect(25);
strictEqual( commonJSDefined, jQuery, "CommonJS registered (Bug #7102)" );
@@ -22,6 +22,7 @@ test("jQuery()", function() {
equals( jQuery(undefined).length, 0, "jQuery(undefined) === jQuery([])" );
equals( jQuery(null).length, 0, "jQuery(null) === jQuery([])" );
equals( jQuery("").length, 0, "jQuery('') === jQuery([])" );
+ equals( jQuery("#").length, 0, "jQuery('#') === jQuery([])" );
var obj = jQuery("div")
equals( jQuery(obj).selector, "div", "jQuery(jQueryObj) == jQueryObj" );