code: function getClosest(elem, selector) {
          while (elem !== document.body) {
              elem = elem.parentElement;
              var matches = typeof elem.matches == 'function' ? elem.matches(selector) : elem.msMatchesSelector(selector);
  
              if (matches) return elem;
          }
      }
docs: Get the closestElement
  
  @param {node} element
  @param {string} class name