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

Function setMatcher

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

Source from the content-addressed store, hash-verified

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

Callers 1

matcherFromTokensFunction · 0.70

Calls 3

markFunctionFunction · 0.70
multipleContextsFunction · 0.70
condenseFunction · 0.70

Tested by

no test coverage detected