* Returns a function to use in pseudos for positionals * @param {Function} fn
( fn )
| 1059 | * @param {Function} fn |
| 1060 | */ |
| 1061 | function createPositionalPseudo( fn ) { |
| 1062 | return markFunction(function( argument ) { |
| 1063 | argument = +argument; |
| 1064 | return markFunction(function( seed, matches ) { |
| 1065 | var j, |
| 1066 | matchIndexes = fn( [], seed.length, argument ), |
| 1067 | i = matchIndexes.length; |
| 1068 | |
| 1069 | // Match elements found at the specified indexes |
| 1070 | while ( i-- ) { |
| 1071 | if ( seed[ (j = matchIndexes[i]) ] ) { |
| 1072 | seed[j] = !(matches[j] = seed[j]); |
| 1073 | } |
| 1074 | } |
| 1075 | }); |
| 1076 | }); |
| 1077 | } |
| 1078 | |
| 1079 | /** |
| 1080 | * Checks a node for validity as a Sizzle context |