aboutsummaryrefslogtreecommitdiffstats
path: root/src/core.js
diff options
context:
space:
mode:
authorcarpie <elcarpie@gmail.com>2011-01-19 17:37:31 -0600
committerDave Methvin <dave.methvin@gmail.com>2011-04-05 23:18:35 -0400
commite0856738e6151368cffc963800e06ebcc0bbc314 (patch)
treecbbaf460a016627e16f1cd57a2946f3774f42cb2 /src/core.js
parentceaf0939422501c9d5f049205cc8f212f852bed5 (diff)
downloadjquery-e0856738e6151368cffc963800e06ebcc0bbc314.tar.gz
jquery-e0856738e6151368cffc963800e06ebcc0bbc314.zip
Skip id regex check when large html strings are passed to the jQuery constructor (#7990).
Diffstat (limited to 'src/core.js')
-rw-r--r--src/core.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core.js b/src/core.js
index f19de96d0..a893fc9b3 100644
--- a/src/core.js
+++ b/src/core.js
@@ -96,7 +96,12 @@ jQuery.fn = jQuery.prototype = {
// Handle HTML strings
if ( typeof selector === "string" ) {
// Are we dealing with HTML string or an ID?
- match = quickExpr.exec( selector );
+ if ( selector.length > 1024 ) {
+ // Assume very large strings are HTML and skip the regex check
+ match = [ null, selector, null ];
+ } else {
+ match = quickExpr.exec( selector );
+ }
// Verify a match, and that no context was specified for #id
if ( match && (match[1] || !context) ) {