(node, screen)
| 2936 | // Find the position of an element by following the offsetParent chain. |
| 2937 | // If screen==true, it returns screen (rather than page) coordinates. |
| 2938 | function eltOffset(node, screen) { |
| 2939 | var bod = node.ownerDocument.body; |
| 2940 | var x = 0, y = 0, skipBody = false; |
| 2941 | for (var n = node; n; n = n.offsetParent) { |
| 2942 | var ol = n.offsetLeft, ot = n.offsetTop; |
| 2943 | // Firefox reports weird inverted offsets when the body has a border. |
| 2944 | if (n == bod) { x += Math.abs(ol); y += Math.abs(ot); } |
| 2945 | else { x += ol, y += ot; } |
| 2946 | if (screen && computedStyle(n).position == "fixed") |
| 2947 | skipBody = true; |
| 2948 | } |
| 2949 | var e = screen && !skipBody ? null : bod; |
| 2950 | for (var n = node.parentNode; n != e; n = n.parentNode) |
| 2951 | if (n.scrollLeft != null) { x -= n.scrollLeft; y -= n.scrollTop;} |
| 2952 | return {left: x, top: y}; |
| 2953 | } |
| 2954 | // Use the faster and saner getBoundingClientRect method when possible. |
| 2955 | if (document.documentElement.getBoundingClientRect != null) eltOffset = function(node, screen) { |
| 2956 | // 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