( selector, parseOnly )
| 2075 | Expr.setFilters = new setFilters(); |
| 2076 | |
| 2077 | function tokenize( selector, parseOnly ) { |
| 2078 | var matched, match, tokens, type, |
| 2079 | soFar, groups, preFilters, |
| 2080 | cached = tokenCache[ selector + " " ]; |
| 2081 | |
| 2082 | if ( cached ) { |
| 2083 | return parseOnly ? 0 : cached.slice( 0 ); |
| 2084 | } |
| 2085 | |
| 2086 | soFar = selector; |
| 2087 | groups = []; |
| 2088 | preFilters = Expr.preFilter; |
| 2089 | |
| 2090 | while ( soFar ) { |
| 2091 | |
| 2092 | // Comma and first run |
| 2093 | if ( !matched || ( match = rcomma.exec( soFar ) ) ) { |
| 2094 | if ( match ) { |
| 2095 | |
| 2096 | // Don't consume trailing commas as valid |
| 2097 | soFar = soFar.slice( match[ 0 ].length ) || soFar; |
| 2098 | } |
| 2099 | groups.push( ( tokens = [] ) ); |
| 2100 | } |
| 2101 | |
| 2102 | matched = false; |
| 2103 | |
| 2104 | // Combinators |
| 2105 | if ( ( match = rleadingCombinator.exec( soFar ) ) ) { |
| 2106 | matched = match.shift(); |
| 2107 | tokens.push( { |
| 2108 | value: matched, |
| 2109 | |
| 2110 | // Cast descendant combinators to space |
| 2111 | type: match[ 0 ].replace( rtrimCSS, " " ) |
| 2112 | } ); |
| 2113 | soFar = soFar.slice( matched.length ); |
| 2114 | } |
| 2115 | |
| 2116 | // Filters |
| 2117 | for ( type in Expr.filter ) { |
| 2118 | if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || |
| 2119 | ( match = preFilters[ type ]( match ) ) ) ) { |
| 2120 | matched = match.shift(); |
| 2121 | tokens.push( { |
| 2122 | value: matched, |
| 2123 | type: type, |
| 2124 | matches: match |
| 2125 | } ); |
| 2126 | soFar = soFar.slice( matched.length ); |
| 2127 | } |
| 2128 | } |
| 2129 | |
| 2130 | if ( !matched ) { |
| 2131 | break; |
| 2132 | } |
| 2133 | } |
| 2134 |
no test coverage detected