( preFilter, selector, matcher, postFilter, postFinder, postSelector )
| 2145 | } |
| 2146 | |
| 2147 | function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { |
| 2148 | if ( postFilter && !postFilter[ expando ] ) { |
| 2149 | postFilter = setMatcher( postFilter ); |
| 2150 | } |
| 2151 | if ( postFinder && !postFinder[ expando ] ) { |
| 2152 | postFinder = setMatcher( postFinder, postSelector ); |
| 2153 | } |
| 2154 | return markFunction(function( seed, results, context, xml ) { |
| 2155 | var temp, i, elem, |
| 2156 | preMap = [], |
| 2157 | postMap = [], |
| 2158 | preexisting = results.length, |
| 2159 | |
| 2160 | // Get initial elements from seed or context |
| 2161 | elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), |
| 2162 | |
| 2163 | // Prefilter to get matcher input, preserving a map for seed-results synchronization |
| 2164 | matcherIn = preFilter && ( seed || !selector ) ? |
| 2165 | condense( elems, preMap, preFilter, context, xml ) : |
| 2166 | elems, |
| 2167 | |
| 2168 | matcherOut = matcher ? |
| 2169 | // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
| 2170 | postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
| 2171 | |
| 2172 | // ...intermediate processing is necessary |
| 2173 | [] : |
| 2174 | |
| 2175 | // ...otherwise use results directly |
| 2176 | results : |
| 2177 | matcherIn; |
| 2178 | |
| 2179 | // Find primary matches |
| 2180 | if ( matcher ) { |
| 2181 | matcher( matcherIn, matcherOut, context, xml ); |
| 2182 | } |
| 2183 | |
| 2184 | // Apply postFilter |
| 2185 | if ( postFilter ) { |
| 2186 | temp = condense( matcherOut, postMap ); |
| 2187 | postFilter( temp, [], context, xml ); |
| 2188 | |
| 2189 | // Un-match failing elements by moving them back to matcherIn |
| 2190 | i = temp.length; |
| 2191 | while ( i-- ) { |
| 2192 | if ( (elem = temp[i]) ) { |
| 2193 | matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); |
| 2194 | } |
| 2195 | } |
| 2196 | } |
| 2197 | |
| 2198 | if ( seed ) { |
| 2199 | if ( postFinder || preFilter ) { |
| 2200 | if ( postFinder ) { |
| 2201 | // Get the final matcherOut by condensing this intermediate into postFinder contexts |
| 2202 | temp = []; |
| 2203 | i = matcherOut.length; |
| 2204 | while ( i-- ) { |
no test coverage detected