( elementMatchers, setMatchers )
| 2215 | } |
| 2216 | |
| 2217 | function matcherFromGroupMatchers( elementMatchers, setMatchers ) { |
| 2218 | var bySet = setMatchers.length > 0, |
| 2219 | byElement = elementMatchers.length > 0, |
| 2220 | superMatcher = function( seed, context, xml, results, outermost ) { |
| 2221 | var elem, j, matcher, |
| 2222 | matchedCount = 0, |
| 2223 | i = "0", |
| 2224 | unmatched = seed && [], |
| 2225 | setMatched = [], |
| 2226 | contextBackup = outermostContext, |
| 2227 | |
| 2228 | // We must always have either seed elements or outermost context |
| 2229 | elems = seed || byElement && jQuery.expr.find.TAG( "*", outermost ), |
| 2230 | |
| 2231 | // Use integer dirruns iff this is the outermost matcher |
| 2232 | dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ); |
| 2233 | |
| 2234 | if ( outermost ) { |
| 2235 | |
| 2236 | // Support: IE 11+ |
| 2237 | // IE sometimes throws a "Permission denied" error when strict-comparing |
| 2238 | // two documents; shallow comparisons work. |
| 2239 | // eslint-disable-next-line eqeqeq |
| 2240 | outermostContext = context == document || context || outermost; |
| 2241 | } |
| 2242 | |
| 2243 | // Add elements passing elementMatchers directly to results |
| 2244 | for ( ; ( elem = elems[ i ] ) != null; i++ ) { |
| 2245 | if ( byElement && elem ) { |
| 2246 | j = 0; |
| 2247 | |
| 2248 | // Support: IE 11+ |
| 2249 | // IE sometimes throws a "Permission denied" error when strict-comparing |
| 2250 | // two documents; shallow comparisons work. |
| 2251 | // eslint-disable-next-line eqeqeq |
| 2252 | if ( !context && elem.ownerDocument != document ) { |
| 2253 | setDocument( elem ); |
| 2254 | xml = !documentIsHTML; |
| 2255 | } |
| 2256 | while ( ( matcher = elementMatchers[ j++ ] ) ) { |
| 2257 | if ( matcher( elem, context || document, xml ) ) { |
| 2258 | push.call( results, elem ); |
| 2259 | break; |
| 2260 | } |
| 2261 | } |
| 2262 | if ( outermost ) { |
| 2263 | dirruns = dirrunsUnique; |
| 2264 | } |
| 2265 | } |
| 2266 | |
| 2267 | // Track unmatched elements for set filters |
| 2268 | if ( bySet ) { |
| 2269 | |
| 2270 | // They will have gone through all possible matchers |
| 2271 | if ( ( elem = !matcher && elem ) ) { |
| 2272 | matchedCount--; |
| 2273 | } |
| 2274 |
no test coverage detected