function closest(elt, selector) {
    elt = asElement(resolveTarget(elt))
    if (elt && elt.closest) {
      return elt.closest(selector)
    } else {
      // TODO remove when IE goes away
      do {
        if (elt == null || matches(elt, selector)) {
          return elt
        }
      }
      while (elt = elt && asElement(parentElt(elt)))
      return null
    }
  }
Finds the closest matching element in the given elements parentage, inclusive of the element

@see https://htmx.org/api/#closest

@param {Element|string} elt the element to find the selector from
@param {string} selector the selector to find
@returns {Element|null}