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=refs%2Fheads%2Fie8-fix;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 {