diff options
author | John Resig <jeresig@gmail.com> | 2009-07-28 12:28:59 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2009-07-28 12:28:59 +0000 |
commit | d6991fa273515a8503692324499edcc71b5c3f64 (patch) | |
tree | 74e6d461e7644d178441dfb9343eab2160acce41 /src/traversing.js | |
parent | 61b18c866c57f9156f746b691517649f2ce628aa (diff) | |
download | jquery-d6991fa273515a8503692324499edcc71b5c3f64.tar.gz jquery-d6991fa273515a8503692324499edcc71b5c3f64.zip |
Added support for .closest(filter, DOMElement). Fixes #4072.
Diffstat (limited to 'src/traversing.js')
-rw-r--r-- | src/traversing.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/traversing.js b/src/traversing.js index db446cf81..f46820f84 100644 --- a/src/traversing.js +++ b/src/traversing.js @@ -51,13 +51,13 @@ jQuery.fn.extend({ return this.pushStack( jQuery.winnow(this, selector, true), "filter", selector ); }, - closest: function( selector ) { + closest: function( selector, context ) { var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null, closer = 0; return this.map(function(){ var cur = this; - while ( cur && cur.ownerDocument ) { + while ( cur && cur.ownerDocument && cur !== context ) { if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) { jQuery.data(cur, "closest", closer); return cur; |