aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dom_utils.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dom_utils.coffee')
-rw-r--r--lib/dom_utils.coffee7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee
index 7232bb45..e6616f51 100644
--- a/lib/dom_utils.coffee
+++ b/lib/dom_utils.coffee
@@ -289,13 +289,14 @@ DomUtils =
setTimeout((-> DomUtils.removeElement flashEl), 400)
getViewportTopLeft: ->
- style = getComputedStyle document.documentElement
+ box = document.documentElement
+ style = getComputedStyle box
if style.position == "static" and not /content|paint|strict/.test(style.contain or "")
zoom = +style.zoom || 1
top: Math.ceil(window.scrollY / zoom), left: Math.ceil(window.scrollX / zoom)
else
- rect = document.documentElement.getBoundingClientRect()
- top: -rect.top, left: -rect.left
+ rect = box.getBoundingClientRect()
+ top: -rect.top - box.clientTop, left: -rect.left - box.clientLeft
suppressPropagation: (event) ->
event.stopImmediatePropagation()