[Pkg-javascript-commits] [d3-tip.js] 159/277: support bulk assignment for attr and style. Fixes #14

bhuvan krishna bhuvan-guest at moszumanska.debian.org
Thu Dec 8 06:57:26 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 95ac6fb65402db0f9ea883e39b6582e50a6dc207
Author: Justin Palmer <justin at github.com>
Date:   Sat Jun 29 10:25:31 2013 -0700

    support bulk assignment for attr and style.  Fixes #14
---
 src/d3.tip.js | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/d3.tip.js b/src/d3.tip.js
index d8de8d7..82ebc87 100644
--- a/src/d3.tip.js
+++ b/src/d3.tip.js
@@ -58,10 +58,11 @@ d3.tip = function() {
   //
   // Returns tip or attribute value
   tip.attr = function(n, v) {
-    if (arguments.length < 2) {
+    if (arguments.length < 2 && typeof n === 'string') {
       return d3.select(node).attr(n)
     } else {
-      d3.select(node).attr(n, v)
+      var args =  Array.prototype.slice.call(arguments)
+      d3.selection.prototype.attr.apply(d3.select(node), args)
     }
 
     return tip;
@@ -74,10 +75,11 @@ d3.tip = function() {
   //
   // Returns tip or style property value
   tip.style = function(n, v) {
-    if (arguments.length < 2) {
+    if (arguments.length < 2 && typeof n === 'string') {
       return d3.select(node).style(n)
     } else {
-      d3.select(node).style(n, v)
+      var args =  Array.prototype.slice.call(arguments)
+      d3.selection.prototype.style.apply(d3.select(node), args)
     }
 
     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