[Pkg-javascript-commits] [d3-tip.js] 05/17: Fixes #88 / #96 (Return when svg node is falsy)

Sunil Mohan Adapa sunilmohan-guest at moszumanska.debian.org
Thu Dec 8 10:37:11 UTC 2016


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

sunilmohan-guest pushed a commit to branch upstream
in repository d3-tip.js.

commit 5f57d020718fdcc54799cc1016c806f7e39c359d
Author: Tim van der Horst <tim.vanderhorst at sportsmedglobal.com>
Date:   Wed Aug 24 12:08:57 2016 +1000

    Fixes #88 / #96 (Return when svg node is falsy)
---
 index.js | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/index.js b/index.js
index 47565a7..35f892c 100644
--- a/index.js
+++ b/index.js
@@ -31,6 +31,7 @@
 
     function tip(vis) {
       svg = getSVGNode(vis)
+      if (!svg) return
       point = svg.createSVGPoint()
       document.body.appendChild(node)
     }
@@ -243,12 +244,11 @@
       return node.node()
     }
 
-    function getSVGNode(el) {
-      el = el.node()
-      if(el.tagName.toLowerCase() === 'svg')
-        return el
-
-      return el.ownerSVGElement
+    function getSVGNode(element) {
+      var svgNode = element.node()
+      if (!svgNode) return null
+      if (svgNode.tagName.toLowerCase() === 'svg') return svgNode
+      return svgNode.ownerSVGElement
     }
 
     function getNodeEl() {

-- 
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