git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Moved exposing window.jQuery and window.$ to the end of the jQuery file (helps some...
[jquery.git]
/
src
/
traversing.js
diff --git
a/src/traversing.js
b/src/traversing.js
index
db446cf
..
f46820f
100644
(file)
--- 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 );
},
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;
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;
if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {
jQuery.data(cur, "closest", closer);
return cur;