aboutsummaryrefslogtreecommitdiffstats
path: root/src/traversing.js
diff options
context:
space:
mode:
authorElijah Manor <elijah.manor@gmail.com>2012-07-30 11:29:15 -0500
committerElijah Manor <elijah.manor@gmail.com>2012-07-30 11:29:15 -0500
commit0d07e7fc2cf33d70ea51ae58cd0c76bf48f8b3be (patch)
tree8c49b1a0b1e499ba8d77a20cf52849c0d7baaad7 /src/traversing.js
parent039222f8bf4591807e5d25e2a2308a79f87e656d (diff)
parentbeeab4d126b303b194899adf579d8f43e3fd5e69 (diff)
downloadjquery-0d07e7fc2cf33d70ea51ae58cd0c76bf48f8b3be.tar.gz
jquery-0d07e7fc2cf33d70ea51ae58cd0c76bf48f8b3be.zip
Manual merge after fetch upstream
Diffstat (limited to 'src/traversing.js')
-rw-r--r--src/traversing.js15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/traversing.js b/src/traversing.js
index 321c25197..4c58ae0b8 100644
--- a/src/traversing.js
+++ b/src/traversing.js
@@ -48,12 +48,12 @@ jQuery.fn.extend({
},
has: function( target ) {
- var i = 0,
+ var i,
targets = jQuery( target, this ),
- l = targets.length;
+ len = targets.length;
return this.filter(function() {
- for ( ; i < l; i++ ) {
+ for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
@@ -92,17 +92,12 @@ 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;
- }
}
+ cur = cur.parentNode;
}
}