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 8d3c0506c860e887d0005fd12da53f1d11ce2883
Showing with 12 additions and 2 deletions.
  1. +11 −1 src/selector-native.js
  2. +1 −1 src/sizzle
@@ -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.
You can’t perform that action at this time.