MCPcopy Create free account
hub / github.com/ceph/ceph / superMatcher

Function superMatcher

qa/workunits/erasure-code/jquery.js:4981–5067  ·  view source on GitHub ↗
( seed, context, xml, results, expandContext )

Source from the content-addressed store, hash-verified

4979 var bySet = setMatchers.length > 0,
4980 byElement = elementMatchers.length > 0,
4981 superMatcher = function( seed, context, xml, results, expandContext ) {
4982 var elem, j, matcher,
4983 setMatched = [],
4984 matchedCount = 0,
4985 i = "0",
4986 unmatched = seed && [],
4987 outermost = expandContext != null,
4988 contextBackup = outermostContext,
4989 // We must always have either seed elements or context
4990 elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
4991 // Nested matchers should use non-integer dirruns
4992 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E);
4993
4994 if ( outermost ) {
4995 outermostContext = context !== document && context;
4996 cachedruns = superMatcher.el;
4997 }
4998
4999 // Add elements passing elementMatchers directly to results
5000 for ( ; (elem = elems[i]) != null; i++ ) {
5001 if ( byElement && elem ) {
5002 for ( j = 0; (matcher = elementMatchers[j]); j++ ) {
5003 if ( matcher( elem, context, xml ) ) {
5004 results.push( elem );
5005 break;
5006 }
5007 }
5008 if ( outermost ) {
5009 dirruns = dirrunsUnique;
5010 cachedruns = ++superMatcher.el;
5011 }
5012 }
5013
5014 // Track unmatched elements for set filters
5015 if ( bySet ) {
5016 // They will have gone through all possible matchers
5017 if ( (elem = !matcher && elem) ) {
5018 matchedCount--;
5019 }
5020
5021 // Lengthen the array for every element, matched or not
5022 if ( seed ) {
5023 unmatched.push( elem );
5024 }
5025 }
5026 }
5027
5028 // Apply set filters to unmatched elements
5029 matchedCount += i;
5030 if ( bySet && i !== matchedCount ) {
5031 for ( j = 0; (matcher = setMatchers[j]); j++ ) {
5032 matcher( unmatched, setMatched, context, xml );
5033 }
5034
5035 if ( seed ) {
5036 // Reintegrate element matches to eliminate the need for sorting
5037 if ( matchedCount > 0 ) {
5038 while ( i-- ) {

Callers

nothing calls this directly

Calls 4

condenseFunction · 0.85
pushMethod · 0.45
callMethod · 0.45
applyMethod · 0.45

Tested by

no test coverage detected