MCPcopy Create free account
hub / github.com/nwutils/nw-sample-apps / setMatcher

Function setMatcher

camera/jquery.js:2163–2254  ·  view source on GitHub ↗
( preFilter, selector, matcher, postFilter, postFinder, postSelector )

Source from the content-addressed store, hash-verified

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

Callers 1

matcherFromTokensFunction · 0.85

Calls 3

markFunctionFunction · 0.85
multipleContextsFunction · 0.85
condenseFunction · 0.85

Tested by

no test coverage detected