(preFilter, selector, matcher, postFilter, postFinder, postSelector)
| 1599 | } |
| 1600 | |
| 1601 | function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) { |
| 1602 | if (postFilter && !postFilter[expando]) { |
| 1603 | postFilter = setMatcher(postFilter); |
| 1604 | } |
| 1605 | if (postFinder && !postFinder[expando]) { |
| 1606 | postFinder = setMatcher(postFinder, postSelector); |
| 1607 | } |
| 1608 | return markFunction(function(seed, results, context, xml) { |
| 1609 | var temp, i, elem, |
| 1610 | preMap = [], |
| 1611 | postMap = [], |
| 1612 | preexisting = results.length, |
| 1613 | |
| 1614 | // Get initial elements from seed or context |
| 1615 | elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []), |
| 1616 | |
| 1617 | // Prefilter to get matcher input, preserving a map for seed-results synchronization |
| 1618 | matcherIn = preFilter && (seed || !selector) ? |
| 1619 | condense(elems, preMap, preFilter, context, xml) : |
| 1620 | elems, |
| 1621 | |
| 1622 | matcherOut = matcher ? |
| 1623 | // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
| 1624 | postFinder || (seed ? preFilter : preexisting || postFilter) ? |
| 1625 | |
| 1626 | // ...intermediate processing is necessary |
| 1627 | [] : |
| 1628 | |
| 1629 | // ...otherwise use results directly |
| 1630 | results : |
| 1631 | matcherIn; |
| 1632 | |
| 1633 | // Find primary matches |
| 1634 | if (matcher) { |
| 1635 | matcher(matcherIn, matcherOut, context, xml); |
| 1636 | } |
| 1637 | |
| 1638 | // Apply postFilter |
| 1639 | if (postFilter) { |
| 1640 | temp = condense(matcherOut, postMap); |
| 1641 | postFilter(temp, [], context, xml); |
| 1642 | |
| 1643 | // Un-match failing elements by moving them back to matcherIn |
| 1644 | i = temp.length; |
| 1645 | while (i--) { |
| 1646 | if ((elem = temp[i])) { |
| 1647 | matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem); |
| 1648 | } |
| 1649 | } |
| 1650 | } |
| 1651 | |
| 1652 | if (seed) { |
| 1653 | if (postFinder || preFilter) { |
| 1654 | if (postFinder) { |
| 1655 | // Get the final matcherOut by condensing this intermediate into postFinder contexts |
| 1656 | temp = []; |
| 1657 | i = matcherOut.length; |
| 1658 | while (i--) { |
no test coverage detected