[Pkg-javascript-commits] [d3-tip.js] 213/277: Correctly detect `document.documentElement`.

bhuvan krishna bhuvan-guest at moszumanska.debian.org
Thu Dec 8 06:57:31 UTC 2016


This is an automated email from the git hooks/post-receive script.

bhuvan-guest pushed a commit to branch master
in repository d3-tip.js.

commit 67bc95cc22004f2fbe9b17569b65418605a5c837
Author: Nick Porter <porter.nicolas at gmail.com>
Date:   Thu Jan 23 17:09:59 2014 -0800

    Correctly detect `document.documentElement`.
    
    Before, if the `document.documentElement.scrollTop` or `document.documentElement.scrollTop` was `0`, the condition evaluated to false and the scroll value was fetched from `document.body` instead. This raised a warning in chrome. Now, we first find the available scroll element and then get its scroll value.
---
 index.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/index.js b/index.js
index 6cfa3cb..e6debb9 100644
--- a/index.js
+++ b/index.js
@@ -250,8 +250,9 @@ d3.tip = function() {
         height     = tbbox.height,
         x          = tbbox.x,
         y          = tbbox.y,
-        scrollTop  = document.documentElement.scrollTop || document.body.scrollTop,
-        scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft
+        scrollEl   = document.documentElement? document.documentElement : document.body,
+        scrollTop  = scrollEl.scrollTop,
+        scrollLeft = scrollEl.scrollLeft
 
 
     point.x = x + scrollLeft

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/d3-tip.js.git



More information about the Pkg-javascript-commits mailing list