Skip to content
Permalink
Browse files
Check nodeType of elements passed to selector-native's find. Fixes #1…
…3577.
  • Loading branch information
timmywil committed May 6, 2013
1 parent 6d04ebf commit 8d3c050
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
@@ -62,12 +62,22 @@ var selector_hasDuplicate,

jQuery.extend({
find: function( selector, context, results, seed ) {
var elem,
var elem, nodeType,
i = 0;

results = results || [];
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 ) {
while ( (elem = seed[i++]) ) {
if ( jQuery.find.matchesSelector(elem, selector) ) {

0 comments on commit 8d3c050

Please sign in to comment.