function ancestor(node, pred) {
  while (node) {
    if (pred(node)) { return node; }
    if (isEditable(node)) { break; }

    node = node.parentNode;
  }
  return null;
}
find nearest ancestor predicate hit

@param {Node} node
@param {Function} pred - predicate function