Made the closest method evaluate the selector with appropriate context.

This commit is contained in:
Robert Katić 2009-11-09 12:39:29 +01:00 committed by John Resig
parent b256a3a266
commit e03aee1aa6

View file

@ -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;