"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.walkUpTreeUntil = walkUpTreeUntil;
/**
 * Walks a DOM tree up to the provided `stopElement`, or if falsy before.
 * @param element
 * @param stopElement
 */
function walkUpTreeUntil(element, shouldStop) {
  var rootElement = element;
  while (rootElement && rootElement.parentElement && !shouldStop(rootElement)) {
    rootElement = rootElement.parentElement;
  }
  return rootElement;
}