Skip to content

Commit e03aee1

Browse files
rkaticjeresig
authored andcommitted
Made the closest method evaluate the selector with appropriate context.
1 parent b256a3a commit e03aee1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/traversing.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ jQuery.fn.extend({
5252
},
5353

5454
closest: function( selector, context ) {
55-
var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null;
55+
var pos = jQuery.expr.match.POS.test( selector ) ?
56+
jQuery( selector, context || this.context ) : null;
5657

5758
return this.map(function(){
5859
var cur = this, closer = 0;

0 commit comments

Comments
 (0)