* Returns a function to use in pseudos for positionals * @param {Function} fn
( fn )
| 984 | * @param {Function} fn |
| 985 | */ |
| 986 | function createPositionalPseudo( fn ) { |
| 987 | return markFunction(function( argument ) { |
| 988 | argument = +argument; |
| 989 | return markFunction(function( seed, matches ) { |
| 990 | var j, |
| 991 | matchIndexes = fn( [], seed.length, argument ), |
| 992 | i = matchIndexes.length; |
| 993 | |
| 994 | // Match elements found at the specified indexes |
| 995 | while ( i-- ) { |
| 996 | if ( seed[ (j = matchIndexes[i]) ] ) { |
| 997 | seed[j] = !(matches[j] = seed[j]); |
| 998 | } |
| 999 | } |
| 1000 | }); |
| 1001 | }); |
| 1002 | } |
| 1003 | |
| 1004 | /** |
| 1005 | * Checks a node for validity as a Sizzle context |
no test coverage detected