code: function nodeWalkAncestors(node, predicate) {
    var parent = node.parentNode;
    if (!parent) {
      return undefined;
    }
    if (predicate(parent)) {
      return parent;
    }
    return nodeWalkAncestors(parent, predicate);
  }
docs: Walk the tree up from the parent of `node`, to its grandparent and so on to
  the root of the tree.  Return the first ancestor that matches the given
  predicate.