src/tooltip.js
function offsetTop (elem) {
    let top = 0

    do {
      if (!isNaN(elem.offsetTop)) top += elem.offsetTop
    } while (elem = elem.offsetParent)

    return top
  }
function offsetTop (elem) {
    let top = 0

    do {
      if (!isNaN(elem.offsetTop)) top += elem.offsetTop
    } while (elem = elem.offsetParent)

    return top
  }
function offsetTop ( elem ) { let top = 0 do { if ( ! isNaN ( elem . offsetTop ) ) top += elem . offsetTop } while ( elem = elem . offsetParent ) return top }
Recursively calculate top offset of an element from the body
Recursively calculate top offset of an element from the body