Permalink
Browse files

Incorrect nodes were selected when loop value (A)(implied '1') was om…

…itted in -of-type(An+B) (i.e n+7 or -n+7). Tidied nth-of-type params.
  • Loading branch information...
1 parent 601ffbb commit fb8977e81a4dd90cca7d79dd75238dc2b9a1d907 @keithclark committed Apr 23, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 jquery-extra-selectors.js
@@ -24,7 +24,7 @@
} else {
var nth = pattern.indexOf("n");
if (nth > -1) {
- loop = parseInt(pattern, 10);
+ loop = parseInt(pattern, 10) || parseInt(pattern.substring(0, nth) + "1", 10);
position -= (parseInt(pattern.substring(nth + 1), 10) || 0) - 1;
} else {
loop = position + 1;
@@ -44,7 +44,7 @@
"only-of-type": function(elm) {
return pseudos["first-of-type"](elm) && pseudos["last-of-type"](elm);
},
- "nth-of-type": function(elm, b, match, all) {
+ "nth-of-type": function(elm, i, match) {
return isNthOf(elm, match[3], "previousSibling");
},
"nth-last-of-type": function(elm, i, match) {

0 comments on commit fb8977e

Please sign in to comment.