toolkit/javascript/d3/src/core/transition-style.js
changeset 47 c0b4a8b5a012
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toolkit/javascript/d3/src/core/transition-style.js	Thu Apr 10 14:20:23 2014 +0200
@@ -0,0 +1,14 @@
+d3_transitionPrototype.style = function(name, value, priority) {
+  if (arguments.length < 3) priority = "";
+  return this.styleTween(name, d3_transitionTween(name, value), priority);
+};
+
+d3_transitionPrototype.styleTween = function(name, tween, priority) {
+  if (arguments.length < 3) priority = "";
+  return this.tween("style." + name, function(d, i) {
+    var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name));
+    return f === d3_transitionRemove
+        ? (this.style.removeProperty(name), null)
+        : f && function(t) { this.style.setProperty(name, f(t), priority); };
+  });
+};