aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2014-12-03 14:51:24 -0500
committerDave Methvin <dave.methvin@gmail.com>2014-12-03 14:51:24 -0500
commit80022c81ce4a07a232afd3c580b0977555a2daec (patch)
tree023abd5908fd43324d1a4bf0de94ce2442aa65ca /src
parentcfe2eae38df411c0f15cbbf927612bc515063bf5 (diff)
downloadjquery-80022c81ce4a07a232afd3c580b0977555a2daec.tar.gz
jquery-80022c81ce4a07a232afd3c580b0977555a2daec.zip
Core: Throw an error on $("#") rather than returning 0-length collection
Closes gh-1682 Thanks @goob for the issue report!
Diffstat (limited to 'src')
-rw-r--r--src/core/init.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/init.js b/src/core/init.js
index 9beaedd04..9357e05a3 100644
--- a/src/core/init.js
+++ b/src/core/init.js
@@ -11,7 +11,8 @@ var rootjQuery,
// 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 <)
- rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
+ // Shortcut simple #id case for speed
+ rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
init = jQuery.fn.init = function( selector, context ) {
var match, elem;