MCPcopy Index your code
hub / github.com/jquery/jquery / setMatcher

Function setMatcher

dist-module/jquery.module.js:2036–2133  ·  view source on GitHub ↗
( preFilter, selector, matcher, postFilter, postFinder, postSelector )

Source from the content-addressed store, hash-verified

2034}
2035
2036function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2037 if ( postFilter && !postFilter[ jQuery.expando ] ) {
2038 postFilter = setMatcher( postFilter );
2039 }
2040 if ( postFinder && !postFinder[ jQuery.expando ] ) {
2041 postFinder = setMatcher( postFinder, postSelector );
2042 }
2043 return markFunction( function( seed, results, context, xml ) {
2044 var temp, i, elem, matcherOut,
2045 preMap = [],
2046 postMap = [],
2047 preexisting = results.length,
2048
2049 // Get initial elements from seed or context
2050 elems = seed ||
2051 multipleContexts( selector || "*",
2052 context.nodeType ? [ context ] : context, [] ),
2053
2054 // Prefilter to get matcher input, preserving a map for seed-results synchronization
2055 matcherIn = preFilter && ( seed || !selector ) ?
2056 condense( elems, preMap, preFilter, context, xml ) :
2057 elems;
2058
2059 if ( matcher ) {
2060
2061 // If we have a postFinder, or filtered seed, or non-seed postFilter
2062 // or preexisting results,
2063 matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2064
2065 // ...intermediate processing is necessary
2066 [] :
2067
2068 // ...otherwise use results directly
2069 results;
2070
2071 // Find primary matches
2072 matcher( matcherIn, matcherOut, context, xml );
2073 } else {
2074 matcherOut = matcherIn;
2075 }
2076
2077 // Apply postFilter
2078 if ( postFilter ) {
2079 temp = condense( matcherOut, postMap );
2080 postFilter( temp, [], context, xml );
2081
2082 // Un-match failing elements by moving them back to matcherIn
2083 i = temp.length;
2084 while ( i-- ) {
2085 if ( ( elem = temp[ i ] ) ) {
2086 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
2087 }
2088 }
2089 }
2090
2091 if ( seed ) {
2092 if ( postFinder || preFilter ) {
2093 if ( postFinder ) {

Callers 1

matcherFromTokensFunction · 0.70

Calls 3

markFunctionFunction · 0.70
multipleContextsFunction · 0.70
condenseFunction · 0.70

Tested by

no test coverage detected