We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3106039 commit 0f03c74Copy full SHA for 0f03c74
src/traversing.js
@@ -52,19 +52,20 @@ jQuery.fn.extend({
52
},
53
54
closest: function( selector, context ) {
55
- var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null,
56
- closer = 0;
+ var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null;
57
58
return this.map(function(){
59
- var cur = this;
+ var cur = this, closer = 0;
60
while ( cur && cur.ownerDocument && cur !== context ) {
61
if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {
62
- jQuery.data(cur, "closest", closer);
+ jQuery.lastCloser = closer;
63
return cur;
64
}
65
cur = cur.parentNode;
66
closer++;
67
+ jQuery.lastCloser = -1;
68
+ return null;
69
});
70
71
0 commit comments