getAncestorWithClass = (el, className) => {

  if (typeof el !== 'object' || typeof className !== 'string') {
    return;
  }

  while (el.parentNode && el.parentNode !== document) {
    el = el.parentNode;
    if (el.classList.contains(className)) {
      return el;
    }
  }

}
If an ancestor that possesses a specified class exists the the
element will be returned, otherwise undefined is returned.

@param {Element} el
@param {string} className