( preFilter, selector, matcher, postFilter, postFinder, postSelector )
| 2558 | } |
| 2559 | |
| 2560 | function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { |
| 2561 | if ( postFilter && !postFilter[ expando ] ) { |
| 2562 | postFilter = setMatcher( postFilter ); |
| 2563 | } |
| 2564 | if ( postFinder && !postFinder[ expando ] ) { |
| 2565 | postFinder = setMatcher( postFinder, postSelector ); |
| 2566 | } |
| 2567 | return markFunction(function( seed, results, context, xml ) { |
| 2568 | var temp, i, elem, |
| 2569 | preMap = [], |
| 2570 | postMap = [], |
| 2571 | preexisting = results.length, |
| 2572 | |
| 2573 | // Get initial elements from seed or context |
| 2574 | elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), |
| 2575 | |
| 2576 | // Prefilter to get matcher input, preserving a map for seed-results synchronization |
| 2577 | matcherIn = preFilter && ( seed || !selector ) ? |
| 2578 | condense( elems, preMap, preFilter, context, xml ) : |
| 2579 | elems, |
| 2580 | |
| 2581 | matcherOut = matcher ? |
| 2582 | // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
| 2583 | postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
| 2584 | |
| 2585 | // ...intermediate processing is necessary |
| 2586 | [] : |
| 2587 | |
| 2588 | // ...otherwise use results directly |
| 2589 | results : |
| 2590 | matcherIn; |
| 2591 | |
| 2592 | // Find primary matches |
| 2593 | if ( matcher ) { |
| 2594 | matcher( matcherIn, matcherOut, context, xml ); |
| 2595 | } |
| 2596 | |
| 2597 | // Apply postFilter |
| 2598 | if ( postFilter ) { |
| 2599 | temp = condense( matcherOut, postMap ); |
| 2600 | postFilter( temp, [], context, xml ); |
| 2601 | |
| 2602 | // Un-match failing elements by moving them back to matcherIn |
| 2603 | i = temp.length; |
| 2604 | while ( i-- ) { |
| 2605 | if ( (elem = temp[i]) ) { |
| 2606 | matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); |
| 2607 | } |
| 2608 | } |
| 2609 | } |
| 2610 | |
| 2611 | if ( seed ) { |
| 2612 | if ( postFinder || preFilter ) { |
| 2613 | if ( postFinder ) { |
| 2614 | // Get the final matcherOut by condensing this intermediate into postFinder contexts |
| 2615 | temp = []; |
| 2616 | i = matcherOut.length; |
| 2617 | while ( i-- ) { |
no test coverage detected