function isConnected(element) {
  return element.isConnected || document.body.contains(element);
}
Determines if an element is attached to the DOM.
@param {Element} element to check
@return {boolean} whether the element is in DOM