Opened 12 years ago
Closed 12 years ago
#7142 closed bug (fixed)
Closest() is broken in 1.4.3
Reported by: | lcr | Owned by: | |
---|---|---|---|
Priority: | blocker | Milestone: | 1.4.3 |
Component: | traversing | Version: | 1.4.2 |
Keywords: | closest broken | Cc: | |
Blocked by: | Blocking: |
Description
The closest method ends in the following loop:
for ( i = 0, l = this.length; i < l; i++ ) {
cur = this[i];
while ( cur ) {
if ( pos ? pos.index(cur) > -1 :
jQuery.find.matchesSelector(cur, selectors) ) {
ret.push( cur ); break;
} else {
cur = r.parentNode;
if (!cur.ownerDocument cur === context ) { break;
}
}
}
} the following line:
cur === context ) { |
will not work if r.parentNode return null, thus it should be changed to
cur === context ) { |
Best regards, Laurent
Note: See
TracTickets for help on using
tickets.
Fixed http://github.com/jquery/jquery/commit/385ca2aa899d2ed953d9e18c95387e72e330b42c