Commit 8d3c0506 authored by Timmy Willison's avatar Timmy Willison

Check nodeType of elements passed to selector-native's find. Fixes #13577.

parent 6d04ebfa
...@@ -62,12 +62,22 @@ var selector_hasDuplicate, ...@@ -62,12 +62,22 @@ var selector_hasDuplicate,
jQuery.extend({ jQuery.extend({
find: function( selector, context, results, seed ) { find: function( selector, context, results, seed ) {
var elem, var elem, nodeType,
i = 0; i = 0;
results = results || []; results = results || [];
context = context || document; context = context || document;
// Same basic safeguard as Sizzle
if ( !selector || typeof selector !== "string" ) {
return results;
}
// Early return if context is not an element or document
if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
return [];
}
if ( seed ) { if ( seed ) {
while ( (elem = seed[i++]) ) { while ( (elem = seed[i++]) ) {
if ( jQuery.find.matchesSelector(elem, selector) ) { if ( jQuery.find.matchesSelector(elem, selector) ) {
......
Subproject commit b8789b87f1ecb00f0de82b2a13a3474dabdab406 Subproject commit 853c272575c692b39d4f9ea10f3f808696d1a574
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment