| @@ 4403-4428 (lines=26) @@ | ||
| 4400 | return match[1].replace( rBackslash, "" ).toLowerCase(); |
|
| 4401 | }, |
|
| 4402 | ||
| 4403 | CHILD: function( match ) { |
|
| 4404 | if ( match[1] === "nth" ) { |
|
| 4405 | if ( !match[2] ) { |
|
| 4406 | Sizzle.error( match[0] ); |
|
| 4407 | } |
|
| 4408 | ||
| 4409 | match[2] = match[2].replace(/^\+|\s*/g, ''); |
|
| 4410 | ||
| 4411 | // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' |
|
| 4412 | var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( |
|
| 4413 | match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || |
|
| 4414 | !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); |
|
| 4415 | ||
| 4416 | // calculate the numbers (first)n+(last) including if they are negative |
|
| 4417 | match[2] = (test[1] + (test[2] || 1)) - 0; |
|
| 4418 | match[3] = test[3] - 0; |
|
| 4419 | } |
|
| 4420 | else if ( match[2] ) { |
|
| 4421 | Sizzle.error( match[0] ); |
|
| 4422 | } |
|
| 4423 | ||
| 4424 | // TODO: Move to normal caching system |
|
| 4425 | match[0] = done++; |
|
| 4426 | ||
| 4427 | return match; |
|
| 4428 | }, |
|
| 4429 | ||
| 4430 | ATTR: function( match, curLoop, inplace, result, not, isXML ) { |
|
| 4431 | var name = match[1] = match[1].replace( rBackslash, "" ); |
|
| @@ 3765-3790 (lines=26) @@ | ||
| 3762 | return match[1].toLowerCase(); |
|
| 3763 | }, |
|
| 3764 | ||
| 3765 | CHILD: function( match ) { |
|
| 3766 | if ( match[1] === "nth" ) { |
|
| 3767 | if ( !match[2] ) { |
|
| 3768 | Sizzle.error( match[0] ); |
|
| 3769 | } |
|
| 3770 | ||
| 3771 | match[2] = match[2].replace(/^\+|\s*/g, ''); |
|
| 3772 | ||
| 3773 | // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' |
|
| 3774 | var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( |
|
| 3775 | match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || |
|
| 3776 | !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); |
|
| 3777 | ||
| 3778 | // calculate the numbers (first)n+(last) including if they are negative |
|
| 3779 | match[2] = (test[1] + (test[2] || 1)) - 0; |
|
| 3780 | match[3] = test[3] - 0; |
|
| 3781 | } |
|
| 3782 | else if ( match[2] ) { |
|
| 3783 | Sizzle.error( match[0] ); |
|
| 3784 | } |
|
| 3785 | ||
| 3786 | // TODO: Move to normal caching system |
|
| 3787 | match[0] = done++; |
|
| 3788 | ||
| 3789 | return match; |
|
| 3790 | }, |
|
| 3791 | ||
| 3792 | ATTR: function( match, curLoop, inplace, result, not, isXML ) { |
|
| 3793 | var name = match[1] = match[1].replace(/\\/g, ""); |
|