( seed, context, xml, results, outermost )
| 2389 | var bySet = setMatchers.length > 0, |
| 2390 | byElement = elementMatchers.length > 0, |
| 2391 | superMatcher = function( seed, context, xml, results, outermost ) { |
| 2392 | var elem, j, matcher, |
| 2393 | matchedCount = 0, |
| 2394 | i = "0", |
| 2395 | unmatched = seed && [], |
| 2396 | setMatched = [], |
| 2397 | contextBackup = outermostContext, |
| 2398 | // We must always have either seed elements or outermost context |
| 2399 | elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), |
| 2400 | // Use integer dirruns iff this is the outermost matcher |
| 2401 | dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), |
| 2402 | len = elems.length; |
| 2403 | |
| 2404 | if ( outermost ) { |
| 2405 | outermostContext = context === document || context || outermost; |
| 2406 | } |
| 2407 | |
| 2408 | // Add elements passing elementMatchers directly to results |
| 2409 | // Support: IE<9, Safari |
| 2410 | // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id |
| 2411 | for ( ; i !== len && (elem = elems[i]) != null; i++ ) { |
| 2412 | if ( byElement && elem ) { |
| 2413 | j = 0; |
| 2414 | if ( !context && elem.ownerDocument !== document ) { |
| 2415 | setDocument( elem ); |
| 2416 | xml = !documentIsHTML; |
| 2417 | } |
| 2418 | while ( (matcher = elementMatchers[j++]) ) { |
| 2419 | if ( matcher( elem, context || document, xml) ) { |
| 2420 | results.push( elem ); |
| 2421 | break; |
| 2422 | } |
| 2423 | } |
| 2424 | if ( outermost ) { |
| 2425 | dirruns = dirrunsUnique; |
| 2426 | } |
| 2427 | } |
| 2428 | |
| 2429 | // Track unmatched elements for set filters |
| 2430 | if ( bySet ) { |
| 2431 | // They will have gone through all possible matchers |
| 2432 | if ( (elem = !matcher && elem) ) { |
| 2433 | matchedCount--; |
| 2434 | } |
| 2435 | |
| 2436 | // Lengthen the array for every element, matched or not |
| 2437 | if ( seed ) { |
| 2438 | unmatched.push( elem ); |
| 2439 | } |
| 2440 | } |
| 2441 | } |
| 2442 | |
| 2443 | // `i` is now the count of elements visited above, and adding it to `matchedCount` |
| 2444 | // makes the latter nonnegative. |
| 2445 | matchedCount += i; |
| 2446 | |
| 2447 | // Apply set filters to unmatched elements |
| 2448 | // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` |
nothing calls this directly
no test coverage detected