(node, screen)
| 3136 | // Find the position of an element by following the offsetParent chain. |
| 3137 | // If screen==true, it returns screen (rather than page) coordinates. |
| 3138 | function eltOffset(node, screen) { |
| 3139 | var bod = node.ownerDocument.body; |
| 3140 | var x = 0, y = 0, skipBody = false; |
| 3141 | for (var n = node; n; n = n.offsetParent) { |
| 3142 | var ol = n.offsetLeft, ot = n.offsetTop; |
| 3143 | // Firefox reports weird inverted offsets when the body has a border. |
| 3144 | if (n == bod) { x += Math.abs(ol); y += Math.abs(ot); } |
| 3145 | else { x += ol, y += ot; } |
| 3146 | if (screen && computedStyle(n).position == "fixed") |
| 3147 | skipBody = true; |
| 3148 | } |
| 3149 | var e = screen && !skipBody ? null : bod; |
| 3150 | for (var n = node.parentNode; n != e; n = n.parentNode) |
| 3151 | if (n.scrollLeft != null) { x -= n.scrollLeft; y -= n.scrollTop;} |
| 3152 | return {left: x, top: y}; |
| 3153 | } |
| 3154 | // Use the faster and saner getBoundingClientRect method when possible. |
| 3155 | if (document.documentElement.getBoundingClientRect != null) eltOffset = function(node, screen) { |
| 3156 | // Take the parts of bounding client rect that we are interested in so we are able to edit if need be, |
no test coverage detected