Skip to content

Commit

Permalink
Made the closest method evaluate the selector with appropriate context.
Browse files Browse the repository at this point in the history
  • Loading branch information
rkatic authored and jeresig committed Nov 9, 2009
1 parent b256a3a commit e03aee1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/traversing.js
Expand Up @@ -52,7 +52,8 @@ jQuery.fn.extend({
},

closest: function( selector, context ) {
var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null;
var pos = jQuery.expr.match.POS.test( selector ) ?
jQuery( selector, context || this.context ) : null;

return this.map(function(){
var cur = this, closer = 0;
Expand Down

0 comments on commit e03aee1

Please sign in to comment.