[Pkg-javascript-commits] [d3-tip.js] 118/277: simplify tip.attr and tip.style

bhuvan krishna bhuvan-guest at moszumanska.debian.org
Thu Dec 8 06:57:22 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 24754f41093d70de64f8814fc618880441f369e4
Author: Justin Palmer <justin at github.com>
Date:   Sun Apr 21 16:01:28 2013 -0700

    simplify tip.attr and tip.style
---
 examples/bars.html |  2 +-
 src/d3.tip.js      | 14 ++------------
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/examples/bars.html b/examples/bars.html
index 05509b1..0b57641 100644
--- a/examples/bars.html
+++ b/examples/bars.html
@@ -5,7 +5,7 @@
   <meta charset="utf-8" />
   <title>Bar Chart</title>
   <script type="text/javascript" src="../components/d3/d3.js"></script>
-  <script type="text/javascript" src="../d3.tip.min.js"></script>
+  <script type="text/javascript" src="../src/d3.tip.js"></script>
   <script type="text/javascript">
     data = [{"total":225,"days":[12,51,60,26,38,31,7]},{"total":279,"days":[42,33,34,72,61,12,25]},{"total":212,"days":[12,59,24,70,36,5,6]},{"total":335,"days":[17,43,38,58,67,72,40]},{"total":329,"days":[40,53,62,48,38,36,52]},{"total":234,"days":[15,25,41,66,35,37,15]},{"total":175,"days":[2,40,23,40,23,34,13]},{"total":308,"days":[20,22,63,55,51,66,31]},{"total":401,"days":[20,64,42,62,88,79,46]},{"total":214,"days":[24,27,25,48,38,28,24]},{"total":332,"days":[26,43,20,109,74,29,31]} [...]
   </script>
diff --git a/src/d3.tip.js b/src/d3.tip.js
index 9bc1c9a..9620669 100644
--- a/src/d3.tip.js
+++ b/src/d3.tip.js
@@ -54,12 +54,7 @@ d3.tip = function() {
   //
   // Returns tip or attribute value
   tip.attr = function(n, v) {
-    if (arguments.length < 2) {
-      return d3.select(node).attr(n)
-    } else {
-      d3.select(node).attr(n, v)
-    }
-
+    d3.select(node).attr(n, v)
     return tip;
   }
 
@@ -70,12 +65,7 @@ d3.tip = function() {
   //
   // Returns tip or style property value
   tip.style = function(n, v) {
-    if (arguments.length < 2) {
-      return d3.select(node).style(n)
-    } else {
-      d3.select(node).style(n, v)
-    }
-
+    d3.select(node).style(n, v)
     return tip;
   }
 

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