* Returns a function to use in pseudos for positionals * @param {Function} fn
( fn )
| 1023 | * @param {Function} fn |
| 1024 | */ |
| 1025 | function createPositionalPseudo( fn ) { |
| 1026 | return markFunction(function( argument ) { |
| 1027 | argument = +argument; |
| 1028 | return markFunction(function( seed, matches ) { |
| 1029 | var j, |
| 1030 | matchIndexes = fn( [], seed.length, argument ), |
| 1031 | i = matchIndexes.length; |
| 1032 | |
| 1033 | // Match elements found at the specified indexes |
| 1034 | while ( i-- ) { |
| 1035 | if ( seed[ (j = matchIndexes[i]) ] ) { |
| 1036 | seed[j] = !(matches[j] = seed[j]); |
| 1037 | } |
| 1038 | } |
| 1039 | }); |
| 1040 | }); |
| 1041 | } |
| 1042 | |
| 1043 | /** |
| 1044 | * Checks a node for validity as a Sizzle context |