MCPcopy Create free account
hub / github.com/JsAaron/jQuery / setMatcher

Function setMatcher

2.1.1/test/jquery-2.1.1.js:2162–2253  ·  view source on GitHub ↗
( preFilter, selector, matcher, postFilter, postFinder, postSelector )

Source from the content-addressed store, hash-verified

2160}
2161
2162function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2163 if ( postFilter && !postFilter[ expando ] ) {
2164 postFilter = setMatcher( postFilter );
2165 }
2166 if ( postFinder && !postFinder[ expando ] ) {
2167 postFinder = setMatcher( postFinder, postSelector );
2168 }
2169 return markFunction(function( seed, results, context, xml ) {
2170 var temp, i, elem,
2171 preMap = [],
2172 postMap = [],
2173 preexisting = results.length,
2174
2175 // Get initial elements from seed or context
2176 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2177
2178 // Prefilter to get matcher input, preserving a map for seed-results synchronization
2179 matcherIn = preFilter && ( seed || !selector ) ?
2180 condense( elems, preMap, preFilter, context, xml ) :
2181 elems,
2182
2183 matcherOut = matcher ?
2184 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2185 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2186
2187 // ...intermediate processing is necessary
2188 [] :
2189
2190 // ...otherwise use results directly
2191 results :
2192 matcherIn;
2193
2194 // Find primary matches
2195 if ( matcher ) {
2196 matcher( matcherIn, matcherOut, context, xml );
2197 }
2198
2199 // Apply postFilter
2200 if ( postFilter ) {
2201 temp = condense( matcherOut, postMap );
2202 postFilter( temp, [], context, xml );
2203
2204 // Un-match failing elements by moving them back to matcherIn
2205 i = temp.length;
2206 while ( i-- ) {
2207 if ( (elem = temp[i]) ) {
2208 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2209 }
2210 }
2211 }
2212
2213 if ( seed ) {
2214 if ( postFinder || preFilter ) {
2215 if ( postFinder ) {
2216 // Get the final matcherOut by condensing this intermediate into postFinder contexts
2217 temp = [];
2218 i = matcherOut.length;
2219 while ( i-- ) {

Callers 1

matcherFromTokensFunction · 0.70

Calls 3

markFunctionFunction · 0.70
multipleContextsFunction · 0.70
condenseFunction · 0.70

Tested by

no test coverage detected