diff options
Diffstat (limited to 'src/traversing.js')
-rw-r--r-- | src/traversing.js | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/traversing.js b/src/traversing.js index 321c25197..baac0399e 100644 --- a/src/traversing.js +++ b/src/traversing.js @@ -92,16 +92,13 @@ jQuery.fn.extend({ for ( ; i < l; i++ ) { cur = this[i]; - while ( cur ) { + while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { ret.push( cur ); break; } else { cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } } } } |