mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Merge branch 'bug11720-nth-argument' of https://github.com/sindresorhus/jquery into 1.8pre
* 'bug11720-nth-argument' of https://github.com/sindresorhus/jquery: Remove unnecessary arguments from .nth(). Fixes #11720
This commit is contained in:
commit
fbee36be16
@ -186,10 +186,10 @@ jQuery.each({
|
|||||||
return jQuery.dir( elem, "parentNode", until );
|
return jQuery.dir( elem, "parentNode", until );
|
||||||
},
|
},
|
||||||
next: function( elem ) {
|
next: function( elem ) {
|
||||||
return jQuery.nth( elem, 2, "nextSibling" );
|
return jQuery.nth( elem, "nextSibling" );
|
||||||
},
|
},
|
||||||
prev: function( elem ) {
|
prev: function( elem ) {
|
||||||
return jQuery.nth( elem, 2, "previousSibling" );
|
return jQuery.nth( elem, "previousSibling" );
|
||||||
},
|
},
|
||||||
nextAll: function( elem ) {
|
nextAll: function( elem ) {
|
||||||
return jQuery.dir( elem, "nextSibling" );
|
return jQuery.dir( elem, "nextSibling" );
|
||||||
@ -260,12 +260,11 @@ jQuery.extend({
|
|||||||
return matched;
|
return matched;
|
||||||
},
|
},
|
||||||
|
|
||||||
nth: function( cur, result, dir, elem ) {
|
nth: function( cur, dir ) {
|
||||||
result = result || 1;
|
|
||||||
var num = 0;
|
var num = 0;
|
||||||
|
|
||||||
for ( ; cur; cur = cur[dir] ) {
|
for ( ; cur; cur = cur[dir] ) {
|
||||||
if ( cur.nodeType === 1 && ++num === result ) {
|
if ( cur.nodeType === 1 && num++ === 1 ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user