Skip id regex check when large html strings are passed to the jQuery constructor (#7990).
This commit is contained in:
parent
ceaf093942
commit
e0856738e6
2 changed files with 20 additions and 2 deletions
|
@ -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) ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue