aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Katić <robert.katic@gmail.com>2009-11-09 12:39:29 +0100
committerJohn Resig <jeresig@gmail.com>2009-11-09 12:39:29 +0100
commite03aee1aa6d26107328052998bdf9f54fa08d9ef (patch)
treeb744dcad9a2a5d59e00b04873d684d5a989bc6bc
parentb256a3a266721f04d38dca59e56b37b9a682b2f2 (diff)
downloadjquery-e03aee1aa6d26107328052998bdf9f54fa08d9ef.tar.gz
jquery-e03aee1aa6d26107328052998bdf9f54fa08d9ef.zip
Made the closest method evaluate the selector with appropriate context.
-rw-r--r--src/traversing.js3
1 files changed, 2 insertions, 1 deletions
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;