( elementMatchers, setMatchers )
| 2669 | } |
| 2670 | |
| 2671 | function matcherFromGroupMatchers( elementMatchers, setMatchers ) { |
| 2672 | var bySet = setMatchers.length > 0, |
| 2673 | byElement = elementMatchers.length > 0, |
| 2674 | superMatcher = function( seed, context, xml, results, outermost ) { |
| 2675 | var elem, j, matcher, |
| 2676 | matchedCount = 0, |
| 2677 | i = "0", |
| 2678 | unmatched = seed && [], |
| 2679 | setMatched = [], |
| 2680 | contextBackup = outermostContext, |
| 2681 | |
| 2682 | // We must always have either seed elements or outermost context |
| 2683 | elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), |
| 2684 | |
| 2685 | // Use integer dirruns iff this is the outermost matcher |
| 2686 | dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), |
| 2687 | len = elems.length; |
| 2688 | |
| 2689 | if ( outermost ) { |
| 2690 | |
| 2691 | // Support: IE 11+, Edge 17 - 18+ |
| 2692 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 2693 | // two documents; shallow comparisons work. |
| 2694 | // eslint-disable-next-line eqeqeq |
| 2695 | outermostContext = context == document || context || outermost; |
| 2696 | } |
| 2697 | |
| 2698 | // Add elements passing elementMatchers directly to results |
| 2699 | // Support: IE<9, Safari |
| 2700 | // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id |
| 2701 | for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { |
| 2702 | if ( byElement && elem ) { |
| 2703 | j = 0; |
| 2704 | |
| 2705 | // Support: IE 11+, Edge 17 - 18+ |
| 2706 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
| 2707 | // two documents; shallow comparisons work. |
| 2708 | // eslint-disable-next-line eqeqeq |
| 2709 | if ( !context && elem.ownerDocument != document ) { |
| 2710 | setDocument( elem ); |
| 2711 | xml = !documentIsHTML; |
| 2712 | } |
| 2713 | while ( ( matcher = elementMatchers[ j++ ] ) ) { |
| 2714 | if ( matcher( elem, context || document, xml ) ) { |
| 2715 | results.push( elem ); |
| 2716 | break; |
| 2717 | } |
| 2718 | } |
| 2719 | if ( outermost ) { |
| 2720 | dirruns = dirrunsUnique; |
| 2721 | } |
| 2722 | } |
| 2723 | |
| 2724 | // Track unmatched elements for set filters |
| 2725 | if ( bySet ) { |
| 2726 | |
| 2727 | // They will have gone through all possible matchers |
| 2728 | if ( ( elem = !matcher && elem ) ) { |
no test coverage detected