function findClickableElement(e) {
  if (!e.tagName) return null
  let tagName = e.tagName.toLowerCase()
  let type = e.type
  if (
    e.hasAttribute('onclick') ||
    e.hasAttribute('href') ||
    tagName == 'button' ||
    (tagName == 'input' &&
      (type == 'submit' ||
        type == 'button' ||
        type == 'image' ||
        type == 'radio' ||
        type == 'checkbox' ||
        type == 'reset'))
  ) {
    return e
  } else {
    if (e.parentNode != null) {
      return findClickableElement(e.parentNode)
    } else {
      return null
    }
  }
}
function findClickableElement(e) {
  if (!e.tagName) return null
  let tagName = e.tagName.toLowerCase()
  let type = e.type
  if (
    e.hasAttribute('onclick') ||
    e.hasAttribute('href') ||
    tagName == 'button' ||
    (tagName == 'input' &&
      (type == 'submit' ||
        type == 'button' ||
        type == 'image' ||
        type == 'radio' ||
        type == 'checkbox' ||
        type == 'reset'))
  ) {
    return e
  } else {
    if (e.parentNode != null) {
      return findClickableElement(e.parentNode)
    } else {
      return null
    }
  }
}
function findClickableElement ( e ) { if ( ! e . tagName ) return null let tagName = e . tagName . toLowerCase ( ) let type = e . type if ( e . hasAttribute ( 'onclick' ) || e . hasAttribute ( 'href' ) || tagName == 'button' || ( tagName == 'input' && ( type == 'submit' || type == 'button' || type == 'image' || type == 'radio' || type == 'checkbox' || type == 'reset' ) ) ) { return e } else { if ( e . parentNode != null ) { return findClickableElement ( e . parentNode ) } else { return null } } }
END
END
Find Clickable Element