From: Dan Vanderkam Date: Sun, 23 Nov 2014 07:03:19 +0000 (-0500) Subject: Fix for IE8 X-Git-Tag: v1.1.0~14^2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=263aca4a4586dd1d9b99f72090ef29d54fc9b124;hp=88a17b3f3b73348cfe2d986b01751814f7c8724b;p=dygraphs.git Fix for IE8 --- diff --git a/dygraph-utils.js b/dygraph-utils.js index 4f90c65..bf93665 100644 --- a/dygraph-utils.js +++ b/dygraph-utils.js @@ -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 {