Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'bug11720-nth-argument' of https://github.com/sindresorh…

…us/jquery into 1.8pre

* 'bug11720-nth-argument' of https://github.com/sindresorhus/jquery:
  Remove unnecessary arguments from .nth(). Fixes #11720
  • Loading branch information...
commit fbee36be16e155cc1384f34a35b455c2413ea94d 2 parents 0add0b3 + 4de7b54
@rwaldron rwaldron authored
Showing with 4 additions and 5 deletions.
  1. +4 −5 src/traversing.js
View
9 src/traversing.js
@@ -186,10 +186,10 @@ jQuery.each({
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
- return jQuery.nth( elem, 2, "nextSibling" );
+ return jQuery.nth( elem, "nextSibling" );
},
prev: function( elem ) {
- return jQuery.nth( elem, 2, "previousSibling" );
+ return jQuery.nth( elem, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
@@ -260,12 +260,11 @@ jQuery.extend({
return matched;
},
- nth: function( cur, result, dir, elem ) {
- result = result || 1;
+ nth: function( cur, dir ) {
var num = 0;
for ( ; cur; cur = cur[dir] ) {
- if ( cur.nodeType === 1 && ++num === result ) {
+ if ( cur.nodeType === 1 && num++ === 1 ) {
break;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.