src/core/dom/query.js
/**
 * Finds the closest element that satisfies the callback from this element
 * up the DOM subtree.
 * @param {HTMLElement} element
 * @param {function(HTMLElement):boolean} callback
 * @param {HTMLElement=} opt_stopAt optional elemnt to stop the search at.
 * @return {?HTMLElement}
 */
Finds the closest element that satisfies the callback from this element
up the DOM subtree.
@param {HTMLElement} element
@param {function(HTMLElement):boolean} callback
@param {HTMLElement=} opt_stopAt optional elemnt to stop the search at.
Finds the closest element that satisfies the callback from this element up the DOM subtree . @param { HTMLElement } element @param { function ( HTMLElement ) : boolean } callback @param { HTMLElement = } opt_stopAt optional elemnt to stop the search at .
function closest(element, callback, opt_stopAt) {
   let el;
  for (el = element; el && el !== opt_stopAt; el = el.parentElement) {
    if (callback(el)) {
      return el;
    }
  }
  return null;
}
function closest ( element , callback , opt_stopAt ) { let el ; for ( el = element ; el && el !== opt_stopAt ; el = el . parentElement ) { if ( callback ( el ) ) { return el ; } } return null ; }
Finds the closest element that satisfies the callback from this element
 up the DOM subtree.
Finds the closest element that satisfies the callback from this element up the DOM subtree .
/** @type {?HTMLElement} */