( preFilter, selector, matcher, postFilter, postFinder, postSelector )
| 1644 | } |
| 1645 | |
| 1646 | function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { |
| 1647 | if ( postFilter && !postFilter[ expando ] ) { |
| 1648 | postFilter = setMatcher( postFilter ); |
| 1649 | } |
| 1650 | if ( postFinder && !postFinder[ expando ] ) { |
| 1651 | postFinder = setMatcher( postFinder, postSelector ); |
| 1652 | } |
| 1653 | return markFunction(function( seed, results, context, xml ) { |
| 1654 | var temp, i, elem, |
| 1655 | preMap = [], |
| 1656 | postMap = [], |
| 1657 | preexisting = results.length, |
| 1658 | |
| 1659 | // Get initial elements from seed or context |
| 1660 | elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), |
| 1661 | |
| 1662 | // Prefilter to get matcher input, preserving a map for seed-results synchronization |
| 1663 | matcherIn = preFilter && ( seed || !selector ) ? |
| 1664 | condense( elems, preMap, preFilter, context, xml ) : |
| 1665 | elems, |
| 1666 | |
| 1667 | matcherOut = matcher ? |
| 1668 | // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
| 1669 | postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
| 1670 | |
| 1671 | // ...intermediate processing is necessary |
| 1672 | [] : |
| 1673 | |
| 1674 | // ...otherwise use results directly |
| 1675 | results : |
| 1676 | matcherIn; |
| 1677 | |
| 1678 | // Find primary matches |
| 1679 | if ( matcher ) { |
| 1680 | matcher( matcherIn, matcherOut, context, xml ); |
| 1681 | } |
| 1682 | |
| 1683 | // Apply postFilter |
| 1684 | if ( postFilter ) { |
| 1685 | temp = condense( matcherOut, postMap ); |
| 1686 | postFilter( temp, [], context, xml ); |
| 1687 | |
| 1688 | // Un-match failing elements by moving them back to matcherIn |
| 1689 | i = temp.length; |
| 1690 | while ( i-- ) { |
| 1691 | if ( (elem = temp[i]) ) { |
| 1692 | matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); |
| 1693 | } |
| 1694 | } |
| 1695 | } |
| 1696 | |
| 1697 | if ( seed ) { |
| 1698 | if ( postFinder || preFilter ) { |
| 1699 | if ( postFinder ) { |
| 1700 | // Get the final matcherOut by condensing this intermediate into postFinder contexts |
| 1701 | temp = []; |
| 1702 | i = matcherOut.length; |
| 1703 | while ( i-- ) { |
no test coverage detected