From e03aee1aa6d26107328052998bdf9f54fa08d9ef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Robert=20Kati=C4=87?= Date: Mon, 9 Nov 2009 12:39:29 +0100 Subject: [PATCH] Made the closest method evaluate the selector with appropriate context. --- src/traversing.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/traversing.js b/src/traversing.js index f7c86f13c..85976a3c0 100644 --- a/src/traversing.js +++ b/src/traversing.js @@ -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; -- 2.39.5