( preFilter, selector, matcher, postFilter, postFinder, postSelector )
| 2534 | } |
| 2535 | |
| 2536 | function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { |
| 2537 | if ( postFilter && !postFilter[ expando ] ) { |
| 2538 | postFilter = setMatcher( postFilter ); |
| 2539 | } |
| 2540 | if ( postFinder && !postFinder[ expando ] ) { |
| 2541 | postFinder = setMatcher( postFinder, postSelector ); |
| 2542 | } |
| 2543 | return markFunction(function( seed, results, context, xml ) { |
| 2544 | var temp, i, elem, |
| 2545 | preMap = [], |
| 2546 | postMap = [], |
| 2547 | preexisting = results.length, |
| 2548 | |
| 2549 | // Get initial elements from seed or context |
| 2550 | elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), |
| 2551 | |
| 2552 | // Prefilter to get matcher input, preserving a map for seed-results synchronization |
| 2553 | matcherIn = preFilter && ( seed || !selector ) ? |
| 2554 | condense( elems, preMap, preFilter, context, xml ) : |
| 2555 | elems, |
| 2556 | |
| 2557 | matcherOut = matcher ? |
| 2558 | // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
| 2559 | postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
| 2560 | |
| 2561 | // ...intermediate processing is necessary |
| 2562 | [] : |
| 2563 | |
| 2564 | // ...otherwise use results directly |
| 2565 | results : |
| 2566 | matcherIn; |
| 2567 | |
| 2568 | // Find primary matches |
| 2569 | if ( matcher ) { |
| 2570 | matcher( matcherIn, matcherOut, context, xml ); |
| 2571 | } |
| 2572 | |
| 2573 | // Apply postFilter |
| 2574 | if ( postFilter ) { |
| 2575 | temp = condense( matcherOut, postMap ); |
| 2576 | postFilter( temp, [], context, xml ); |
| 2577 | |
| 2578 | // Un-match failing elements by moving them back to matcherIn |
| 2579 | i = temp.length; |
| 2580 | while ( i-- ) { |
| 2581 | if ( (elem = temp[i]) ) { |
| 2582 | matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); |
| 2583 | } |
| 2584 | } |
| 2585 | } |
| 2586 | |
| 2587 | if ( seed ) { |
| 2588 | if ( postFinder || preFilter ) { |
| 2589 | if ( postFinder ) { |
| 2590 | // Get the final matcherOut by condensing this intermediate into postFinder contexts |
| 2591 | temp = []; |
| 2592 | i = matcherOut.length; |
| 2593 | while ( i-- ) { |
no test coverage detected