From 80022c81ce4a07a232afd3c580b0977555a2daec Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Wed, 3 Dec 2014 14:51:24 -0500 Subject: Core: Throw an error on $("#") rather than returning 0-length collection Closes gh-1682 Thanks @goob for the issue report! --- src/core/init.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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 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; -- cgit v1.2.3