( preFilter, selector, matcher, postFilter, postFinder, postSelector )
| 5174 | } |
| 5175 | |
| 5176 | function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { |
| 5177 | if ( postFilter && !postFilter[ expando ] ) { |
| 5178 | postFilter = setMatcher( postFilter ); |
| 5179 | } |
| 5180 | if ( postFinder && !postFinder[ expando ] ) { |
| 5181 | postFinder = setMatcher( postFinder, postSelector ); |
| 5182 | } |
| 5183 | return markFunction(function( seed, results, context, xml ) { |
| 5184 | var temp, i, elem, |
| 5185 | preMap = [], |
| 5186 | postMap = [], |
| 5187 | preexisting = results.length, |
| 5188 | |
| 5189 | // Get initial elements from seed or context |
| 5190 | elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), |
| 5191 | |
| 5192 | // Prefilter to get matcher input, preserving a map for seed-results synchronization |
| 5193 | matcherIn = preFilter && ( seed || !selector ) ? |
| 5194 | condense( elems, preMap, preFilter, context, xml ) : |
| 5195 | elems, |
| 5196 | |
| 5197 | matcherOut = matcher ? |
| 5198 | // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
| 5199 | postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
| 5200 | |
| 5201 | // ...intermediate processing is necessary |
| 5202 | [] : |
| 5203 | |
| 5204 | // ...otherwise use results directly |
| 5205 | results : |
| 5206 | matcherIn; |
| 5207 | |
| 5208 | // Find primary matches |
| 5209 | if ( matcher ) { |
| 5210 | matcher( matcherIn, matcherOut, context, xml ); |
| 5211 | } |
| 5212 | |
| 5213 | // Apply postFilter |
| 5214 | if ( postFilter ) { |
| 5215 | temp = condense( matcherOut, postMap ); |
| 5216 | postFilter( temp, [], context, xml ); |
| 5217 | |
| 5218 | // Un-match failing elements by moving them back to matcherIn |
| 5219 | i = temp.length; |
| 5220 | while ( i-- ) { |
| 5221 | if ( (elem = temp[i]) ) { |
| 5222 | matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); |
| 5223 | } |
| 5224 | } |
| 5225 | } |
| 5226 | |
| 5227 | if ( seed ) { |
| 5228 | if ( postFinder || preFilter ) { |
| 5229 | if ( postFinder ) { |
| 5230 | // Get the final matcherOut by condensing this intermediate into postFinder contexts |
| 5231 | temp = []; |
| 5232 | i = matcherOut.length; |
| 5233 | while ( i-- ) { |
no test coverage detected