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