( preFilter, selector, matcher, postFilter, postFinder, postSelector )
| 2428 | } |
| 2429 | |
| 2430 | function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { |
| 2431 | if ( postFilter && !postFilter[ expando ] ) { |
| 2432 | postFilter = setMatcher( postFilter ); |
| 2433 | } |
| 2434 | if ( postFinder && !postFinder[ expando ] ) { |
| 2435 | postFinder = setMatcher( postFinder, postSelector ); |
| 2436 | } |
| 2437 | return markFunction(function( seed, results, context, xml ) { |
| 2438 | var temp, i, elem, |
| 2439 | preMap = [], |
| 2440 | postMap = [], |
| 2441 | preexisting = results.length, |
| 2442 | |
| 2443 | // Get initial elements from seed or context |
| 2444 | elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), |
| 2445 | |
| 2446 | // Prefilter to get matcher input, preserving a map for seed-results synchronization |
| 2447 | matcherIn = preFilter && ( seed || !selector ) ? |
| 2448 | condense( elems, preMap, preFilter, context, xml ) : |
| 2449 | elems, |
| 2450 | |
| 2451 | matcherOut = matcher ? |
| 2452 | // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
| 2453 | postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
| 2454 | |
| 2455 | // ...intermediate processing is necessary |
| 2456 | [] : |
| 2457 | |
| 2458 | // ...otherwise use results directly |
| 2459 | results : |
| 2460 | matcherIn; |
| 2461 | |
| 2462 | // Find primary matches |
| 2463 | if ( matcher ) { |
| 2464 | matcher( matcherIn, matcherOut, context, xml ); |
| 2465 | } |
| 2466 | |
| 2467 | // Apply postFilter |
| 2468 | if ( postFilter ) { |
| 2469 | temp = condense( matcherOut, postMap ); |
| 2470 | postFilter( temp, [], context, xml ); |
| 2471 | |
| 2472 | // Un-match failing elements by moving them back to matcherIn |
| 2473 | i = temp.length; |
| 2474 | while ( i-- ) { |
| 2475 | if ( (elem = temp[i]) ) { |
| 2476 | matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); |
| 2477 | } |
| 2478 | } |
| 2479 | } |
| 2480 | |
| 2481 | if ( seed ) { |
| 2482 | if ( postFinder || preFilter ) { |
| 2483 | if ( postFinder ) { |
| 2484 | // Get the final matcherOut by condensing this intermediate into postFinder contexts |
| 2485 | temp = []; |
| 2486 | i = matcherOut.length; |
| 2487 | while ( i-- ) { |
no test coverage detected