]> source.dussan.org Git - jquery.git/commitdiff
Made the closest method evaluate the selector with appropriate context.
authorRobert Katić <robert.katic@gmail.com>
Mon, 9 Nov 2009 11:39:29 +0000 (12:39 +0100)
committerJohn Resig <jeresig@gmail.com>
Mon, 9 Nov 2009 11:39:29 +0000 (12:39 +0100)
src/traversing.js

index f7c86f13c3312960bc1464e88dede681d7c65e4e..85976a3c05baaaa40c4f0db24ccaa4b39b707eeb 100644 (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;