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

Function setMatcher

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

Source from the content-addressed store, hash-verified

2197}
2198
2199function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2200 if ( postFilter && !postFilter[ expando ] ) {
2201 postFilter = setMatcher( postFilter );
2202 }
2203 if ( postFinder && !postFinder[ expando ] ) {
2204 postFinder = setMatcher( postFinder, postSelector );
2205 }
2206 return markFunction(function( seed, results, context, xml ) {
2207 var temp, i, elem,
2208 preMap = [],
2209 postMap = [],
2210 preexisting = results.length,
2211
2212 // Get initial elements from seed or context
2213 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2214
2215 // Prefilter to get matcher input, preserving a map for seed-results synchronization
2216 matcherIn = preFilter && ( seed || !selector ) ?
2217 condense( elems, preMap, preFilter, context, xml ) :
2218 elems,
2219
2220 matcherOut = matcher ?
2221 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2222 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2223
2224 // ...intermediate processing is necessary
2225 [] :
2226
2227 // ...otherwise use results directly
2228 results :
2229 matcherIn;
2230
2231 // Find primary matches
2232 if ( matcher ) {
2233 matcher( matcherIn, matcherOut, context, xml );
2234 }
2235
2236 // Apply postFilter
2237 if ( postFilter ) {
2238 temp = condense( matcherOut, postMap );
2239 postFilter( temp, [], context, xml );
2240
2241 // Un-match failing elements by moving them back to matcherIn
2242 i = temp.length;
2243 while ( i-- ) {
2244 if ( (elem = temp[i]) ) {
2245 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2246 }
2247 }
2248 }
2249
2250 if ( seed ) {
2251 if ( postFinder || preFilter ) {
2252 if ( postFinder ) {
2253 // Get the final matcherOut by condensing this intermediate into postFinder contexts
2254 temp = [];
2255 i = matcherOut.length;
2256 while ( i-- ) {

Callers 1

matcherFromTokensFunction · 0.70

Calls 3

markFunctionFunction · 0.70
multipleContextsFunction · 0.70
condenseFunction · 0.70

Tested by

no test coverage detected