Fix for IE8 ie8-fix
authorDan Vanderkam <danvdk@gmail.com>
Sun, 23 Nov 2014 07:03:19 +0000 (02:03 -0500)
committerDan Vanderkam <danvdk@gmail.com>
Sun, 23 Nov 2014 07:03:19 +0000 (02:03 -0500)
dygraph-utils.js

index 4f90c65..bf93665 100644 (file)
@@ -1148,7 +1148,13 @@ Dygraph.toRGB_ = function(colorStr) {
   div.style.backgroundColor = colorStr;
   div.style.visibility = 'hidden';
   document.body.appendChild(div);
-  var rgbStr = window.getComputedStyle(div, null).backgroundColor;
+  var rgbStr;
+  if (window.getComputedStyle) {
+    rgbStr = window.getComputedStyle(div, null).backgroundColor;
+  } else {
+    // IE8
+    rgbStr = div.currentStyle.backgroundColor;
+  }
   document.body.removeChild(div);
   var bits = /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(rgbStr);
   return {