( seed, context, xml, results, outermost )
| 2688 | var bySet = setMatchers.length > 0, |
| 2689 | byElement = elementMatchers.length > 0, |
| 2690 | superMatcher = function( seed, context, xml, results, outermost ) { |
| 2691 | var elem, j, matcher, |
| 2692 | matchedCount = 0, |
| 2693 | i = "0", |
| 2694 | unmatched = seed && [], |
| 2695 | setMatched = [], |
| 2696 | contextBackup = outermostContext, |
| 2697 | // We must always have either seed elements or outermost context |
| 2698 | elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), |
| 2699 | // Use integer dirruns iff this is the outermost matcher |
| 2700 | dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), |
| 2701 | len = elems.length; |
| 2702 | |
| 2703 | if ( outermost ) { |
| 2704 | outermostContext = context === document || context || outermost; |
| 2705 | } |
| 2706 | |
| 2707 | // Add elements passing elementMatchers directly to results |
| 2708 | // Support: IE<9, Safari |
| 2709 | // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id |
| 2710 | for ( ; i !== len && (elem = elems[i]) != null; i++ ) { |
| 2711 | if ( byElement && elem ) { |
| 2712 | j = 0; |
| 2713 | if ( !context && elem.ownerDocument !== document ) { |
| 2714 | setDocument( elem ); |
| 2715 | xml = !documentIsHTML; |
| 2716 | } |
| 2717 | while ( (matcher = elementMatchers[j++]) ) { |
| 2718 | if ( matcher( elem, context || document, xml) ) { |
| 2719 | results.push( elem ); |
| 2720 | break; |
| 2721 | } |
| 2722 | } |
| 2723 | if ( outermost ) { |
| 2724 | dirruns = dirrunsUnique; |
| 2725 | } |
| 2726 | } |
| 2727 | |
| 2728 | // Track unmatched elements for set filters |
| 2729 | if ( bySet ) { |
| 2730 | // They will have gone through all possible matchers |
| 2731 | if ( (elem = !matcher && elem) ) { |
| 2732 | matchedCount--; |
| 2733 | } |
| 2734 | |
| 2735 | // Lengthen the array for every element, matched or not |
| 2736 | if ( seed ) { |
| 2737 | unmatched.push( elem ); |
| 2738 | } |
| 2739 | } |
| 2740 | } |
| 2741 | |
| 2742 | // `i` is now the count of elements visited above, and adding it to `matchedCount` |
| 2743 | // makes the latter nonnegative. |
| 2744 | matchedCount += i; |
| 2745 | |
| 2746 | // Apply set filters to unmatched elements |
| 2747 | // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` |
nothing calls this directly
no test coverage detected