MCPcopy
hub / github.com/hoothin/UserScripts / getElementTop

Function getElementTop

Pagetual/pagetual.user.js:10685–10697  ·  view source on GitHub ↗
(ele)

Source from the content-addressed store, hash-verified

10683 }
10684
10685 function getElementTop(ele) {
10686 if (!ele) return 0;
10687 if (ele.getBoundingClientRect) {
10688 return ele.getBoundingClientRect().top + document.documentElement.scrollTop;
10689 }
10690 var actualTop = ele.offsetTop;
10691 var current = ele.offsetParent;
10692 while (current) {
10693 actualTop += current.offsetTop;
10694 current = current.offsetParent;
10695 }
10696 return actualTop;
10697 }
10698
10699 function getElementLeft(ele) {
10700 if (!ele) return 0;

Callers 4

checkElementMethod · 0.85
getPageElementMethod · 0.85
verifyNextMethod · 0.85
getElementBottomFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected