( preFilter, selector, matcher, postFilter, postFinder, postSelector )
| 2480 | } |
| 2481 | |
| 2482 | function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { |
| 2483 | if ( postFilter && !postFilter[ expando ] ) { |
| 2484 | postFilter = setMatcher( postFilter ); |
| 2485 | } |
| 2486 | if ( postFinder && !postFinder[ expando ] ) { |
| 2487 | postFinder = setMatcher( postFinder, postSelector ); |
| 2488 | } |
| 2489 | return markFunction(function( seed, results, context, xml ) { |
| 2490 | var temp, i, elem, |
| 2491 | preMap = [], |
| 2492 | postMap = [], |
| 2493 | preexisting = results.length, |
| 2494 | |
| 2495 | // Get initial elements from seed or context |
| 2496 | elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), |
| 2497 | |
| 2498 | // Prefilter to get matcher input, preserving a map for seed-results synchronization |
| 2499 | matcherIn = preFilter && ( seed || !selector ) ? |
| 2500 | condense( elems, preMap, preFilter, context, xml ) : |
| 2501 | elems, |
| 2502 | |
| 2503 | matcherOut = matcher ? |
| 2504 | // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
| 2505 | postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
| 2506 | |
| 2507 | // ...intermediate processing is necessary |
| 2508 | [] : |
| 2509 | |
| 2510 | // ...otherwise use results directly |
| 2511 | results : |
| 2512 | matcherIn; |
| 2513 | |
| 2514 | // Find primary matches |
| 2515 | if ( matcher ) { |
| 2516 | matcher( matcherIn, matcherOut, context, xml ); |
| 2517 | } |
| 2518 | |
| 2519 | // Apply postFilter |
| 2520 | if ( postFilter ) { |
| 2521 | temp = condense( matcherOut, postMap ); |
| 2522 | postFilter( temp, [], context, xml ); |
| 2523 | |
| 2524 | // Un-match failing elements by moving them back to matcherIn |
| 2525 | i = temp.length; |
| 2526 | while ( i-- ) { |
| 2527 | if ( (elem = temp[i]) ) { |
| 2528 | matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); |
| 2529 | } |
| 2530 | } |
| 2531 | } |
| 2532 | |
| 2533 | if ( seed ) { |
| 2534 | if ( postFinder || preFilter ) { |
| 2535 | if ( postFinder ) { |
| 2536 | // Get the final matcherOut by condensing this intermediate into postFinder contexts |
| 2537 | temp = []; |
| 2538 | i = matcherOut.length; |
| 2539 | while ( i-- ) { |
no test coverage detected