( preFilter, selector, matcher, postFilter, postFinder, postSelector )
| 2274 | } |
| 2275 | |
| 2276 | function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { |
| 2277 | if ( postFilter && !postFilter[ expando ] ) { |
| 2278 | postFilter = setMatcher( postFilter ); |
| 2279 | } |
| 2280 | if ( postFinder && !postFinder[ expando ] ) { |
| 2281 | postFinder = setMatcher( postFinder, postSelector ); |
| 2282 | } |
| 2283 | return markFunction(function( seed, results, context, xml ) { |
| 2284 | var temp, i, elem, |
| 2285 | preMap = [], |
| 2286 | postMap = [], |
| 2287 | preexisting = results.length, |
| 2288 | |
| 2289 | // Get initial elements from seed or context |
| 2290 | elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), |
| 2291 | |
| 2292 | // Prefilter to get matcher input, preserving a map for seed-results synchronization |
| 2293 | matcherIn = preFilter && ( seed || !selector ) ? |
| 2294 | condense( elems, preMap, preFilter, context, xml ) : |
| 2295 | elems, |
| 2296 | |
| 2297 | matcherOut = matcher ? |
| 2298 | // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
| 2299 | postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
| 2300 | |
| 2301 | // ...intermediate processing is necessary |
| 2302 | [] : |
| 2303 | |
| 2304 | // ...otherwise use results directly |
| 2305 | results : |
| 2306 | matcherIn; |
| 2307 | |
| 2308 | // Find primary matches |
| 2309 | if ( matcher ) { |
| 2310 | matcher( matcherIn, matcherOut, context, xml ); |
| 2311 | } |
| 2312 | |
| 2313 | // Apply postFilter |
| 2314 | if ( postFilter ) { |
| 2315 | temp = condense( matcherOut, postMap ); |
| 2316 | postFilter( temp, [], context, xml ); |
| 2317 | |
| 2318 | // Un-match failing elements by moving them back to matcherIn |
| 2319 | i = temp.length; |
| 2320 | while ( i-- ) { |
| 2321 | if ( (elem = temp[i]) ) { |
| 2322 | matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); |
| 2323 | } |
| 2324 | } |
| 2325 | } |
| 2326 | |
| 2327 | if ( seed ) { |
| 2328 | if ( postFinder || preFilter ) { |
| 2329 | if ( postFinder ) { |
| 2330 | // Get the final matcherOut by condensing this intermediate into postFinder contexts |
| 2331 | temp = []; |
| 2332 | i = matcherOut.length; |
| 2333 | while ( i-- ) { |
no test coverage detected