packages/mip/src/util/dom/dom.js
function closestTo (element, selector, target) {
  let closestElement = closest(element, selector)
  return contains(target, closestElement) ? closestElement : null
}
function closestTo (element, selector, target) {
  let closestElement = closest(element, selector)
  return contains(target, closestElement) ? closestElement : null
}
function closestTo ( element , selector , target ) { let closestElement = closest ( element , selector ) return contains ( target , closestElement ) ? closestElement : null }
Find the nearest element that matches the selector from current element to target element.

@param {HTMLElement} element element
@param {string} selector element selector
@param {HTMLElement} target target element
@return {?HTMLElement}
Find the nearest element that matches the selector from current element to target element .