MCPcopy Create free account
hub / github.com/sql-js/sql.js / addCombinator

Function addCombinator

documentation/javascript/application.js:5633–5684  ·  view source on GitHub ↗
( matcher, combinator, context, xml )

Source from the content-addressed store, hash-verified

5631}
5632
5633function addCombinator( matcher, combinator, context, xml ) {
5634 var dir = combinator.dir,
5635 doneName = done++;
5636
5637 if ( !matcher ) {
5638 // If there is no matcher to check, check against the context
5639 matcher = function( elem ) {
5640 return elem === context;
5641 };
5642 }
5643 return combinator.first ?
5644 function( elem ) {
5645 while ( (elem = elem[ dir ]) ) {
5646 if ( elem.nodeType === 1 ) {
5647 return matcher( elem ) && elem;
5648 }
5649 }
5650 } :
5651 xml ?
5652 function( elem ) {
5653 while ( (elem = elem[ dir ]) ) {
5654 if ( elem.nodeType === 1 ) {
5655 if ( matcher( elem ) ) {
5656 return elem;
5657 }
5658 }
5659 }
5660 } :
5661 function( elem ) {
5662 var cache,
5663 dirkey = doneName + "." + dirruns,
5664 cachedkey = dirkey + "." + cachedruns;
5665 while ( (elem = elem[ dir ]) ) {
5666 if ( elem.nodeType === 1 ) {
5667 if ( (cache = elem[ expando ]) === cachedkey ) {
5668 return elem.sizset;
5669 } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) {
5670 if ( elem.sizset ) {
5671 return elem;
5672 }
5673 } else {
5674 elem[ expando ] = cachedkey;
5675 if ( matcher( elem ) ) {
5676 elem.sizset = true;
5677 return elem;
5678 }
5679 elem.sizset = false;
5680 }
5681 }
5682 }
5683 };
5684}
5685
5686function addMatcher( higher, deeper ) {
5687 return higher ?

Callers 1

matcherFromTokensFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…