function ancestorMatch(el, tokens, dividedTokens, root) {
      var cand
      // recursively work backwards through the tokens and up the dom, covering all options
      function crawl(e, i, p) {
        while (p = walker[dividedTokens[i]](p, e)) {
          if (isNode(p) && (found = interpret.apply(p, q(tokens[i])))) {
            if (i) {
              if (cand = crawl(p, i - 1, p)) return cand
            } else return p
          }
        }
      }
      return (cand = crawl(el, tokens.length - 1, el)) && (!root || isAncestor(cand, root))
    }
// given elements matching the right-most part of a selector, filter out any that don't match the rest
given elements matching the right-most part of a selector, filter out any that don't match the rest
given elements matching the right - most part of a selector filter out any that don ' t match the rest
function ancestorMatch(el, tokens, dividedTokens, root) {
      var cand
      function crawl(e, i, p) {
        while (p = walker[dividedTokens[i]](p, e)) {
          if (isNode(p) && (found = interpret.apply(p, q(tokens[i])))) {
            if (i) {
              if (cand = crawl(p, i - 1, p)) return cand
            } else return p
          }
        }
      }
      return (cand = crawl(el, tokens.length - 1, el)) && (!root || isAncestor(cand, root))
    }
function ancestorMatch ( el , tokens , dividedTokens , root ) { var cand function crawl ( e , i , p ) { while ( p = walker [ dividedTokens [ i ] ] ( p , e ) ) { if ( isNode ( p ) && ( found = interpret . apply ( p , q ( tokens [ i ] ) ) ) ) { if ( i ) { if ( cand = crawl ( p , i - 1 , p ) ) return cand } else return p } } } return ( cand = crawl ( el , tokens . length - 1 , el ) ) && ( ! root || isAncestor ( cand , root ) ) }
given elements matching the right-most part of a selector, filter out any that don't match the rest
given elements matching the right - most part of a selector filter out any that don ' t match the rest
// recursively work backwards through the tokens and up the dom, covering all options