src/core/dom/query.js
/**
 * Finds the closest ancestor element with the specified selector from this
 * element.
 * @param {HTMLElement} element
 * @param {string} selector
 * @return {?HTMLElement} closest ancestor if found.
 */
Finds the closest ancestor element with the specified selector from this
element.
@param {HTMLElement} element
@param {string} selector
@return {?HTMLElement} closest ancestor if found.
Finds the closest ancestor element with the specified selector from this element . @param { HTMLElement } element @param { string } selector @return { ?HTMLElement } closest ancestor if found .
function closestAncestorElementBySelector(element, selector) {
  return element.closest
    ? element.closest(selector)
    : closest(element, (el) => matches(el, selector));
}
function closestAncestorElementBySelector ( element , selector ) { return element . closest ? element . closest ( selector ) : closest ( element , ( el ) => matches ( el , selector ) ) ; }
Finds the closest ancestor element with the specified selector from this
 element.
Finds the closest ancestor element with the specified selector from this element .