Side navigation
#7142 closed bug (fixed)
Opened October 11, 2010 08:33AM UTC
Closed October 11, 2010 11:46AM UTC
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:
if (!cur.ownerDocument || cur === context ) {
will not work if r.parentNode return null,
thus it should be changed to
if (cur && !cur.ownerDocument || cur === context ) {
Best regards,
Laurent
Attachments (0)
Change History (1)
Changed October 11, 2010 11:46AM UTC by comment:1
resolution: | → fixed |
---|---|
status: | new → closed |
Fixed http://github.com/jquery/jquery/commit/385ca2aa899d2ed953d9e18c95387e72e330b42c