packages/building-webpack/dom5-fork/index.js
function nodeWalkAncestors(node, predicate) {
  var parent = node.parentNode;
  if (!parent) {
    return undefined;
  }
  if (predicate(parent)) {
    return parent;
  }
  return nodeWalkAncestors(parent, predicate);
}
function nodeWalkAncestors(node, predicate) {
  var parent = node.parentNode;
  if (!parent) {
    return undefined;
  }
  if (predicate(parent)) {
    return parent;
  }
  return nodeWalkAncestors(parent, predicate);
}
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.