(preFilter, selector, matcher, postFilter, postFinder, postSelector)
| 1770 | } |
| 1771 | |
| 1772 | function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) { |
| 1773 | if (postFilter && !postFilter[expando]) { |
| 1774 | postFilter = setMatcher(postFilter); |
| 1775 | } |
| 1776 | if (postFinder && !postFinder[expando]) { |
| 1777 | postFinder = setMatcher(postFinder, postSelector); |
| 1778 | } |
| 1779 | return markFunction(function(seed, results, context, xml) { |
| 1780 | var temp, i, elem, |
| 1781 | preMap = [], |
| 1782 | postMap = [], |
| 1783 | preexisting = results.length, |
| 1784 | |
| 1785 | // Get initial elements from seed or context |
| 1786 | elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []), |
| 1787 | |
| 1788 | // Prefilter to get matcher input, preserving a map for seed-results synchronization |
| 1789 | matcherIn = preFilter && (seed || !selector) ? |
| 1790 | condense(elems, preMap, preFilter, context, xml) : |
| 1791 | elems, |
| 1792 | |
| 1793 | matcherOut = matcher ? |
| 1794 | // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
| 1795 | postFinder || (seed ? preFilter : preexisting || postFilter) ? |
| 1796 | |
| 1797 | // ...intermediate processing is necessary |
| 1798 | [] : |
| 1799 | |
| 1800 | // ...otherwise use results directly |
| 1801 | results : |
| 1802 | matcherIn; |
| 1803 | |
| 1804 | // Find primary matches |
| 1805 | if (matcher) { |
| 1806 | matcher(matcherIn, matcherOut, context, xml); |
| 1807 | } |
| 1808 | |
| 1809 | // Apply postFilter |
| 1810 | if (postFilter) { |
| 1811 | temp = condense(matcherOut, postMap); |
| 1812 | postFilter(temp, [], context, xml); |
| 1813 | |
| 1814 | // Un-match failing elements by moving them back to matcherIn |
| 1815 | i = temp.length; |
| 1816 | while (i--) { |
| 1817 | if ((elem = temp[i])) { |
| 1818 | matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem); |
| 1819 | } |
| 1820 | } |
| 1821 | } |
| 1822 | |
| 1823 | if (seed) { |
| 1824 | if (postFinder || preFilter) { |
| 1825 | if (postFinder) { |
| 1826 | // Get the final matcherOut by condensing this intermediate into postFinder contexts |
| 1827 | temp = []; |
| 1828 | i = matcherOut.length; |
| 1829 | while (i--) { |
no test coverage detected