From: Dan Vanderkam Date: Wed, 20 Feb 2013 01:18:54 +0000 (-0500) Subject: guard window.getComputedStyle call for IE8 X-Git-Tag: v1.0.0~55 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=4ff8c62e5e2e62e81e993fa1df626e62e385d28c;p=dygraphs.git guard window.getComputedStyle call for IE8 --- diff --git a/dygraph-utils.js b/dygraph-utils.js index 6aa7dfc..8c6942b 100644 --- a/dygraph-utils.js +++ b/dygraph-utils.js @@ -301,7 +301,10 @@ Dygraph.findPosX = function(obj) { if(obj.offsetParent) { var copyObj = obj; while(1) { - var borderLeft = window.getComputedStyle(copyObj, null).borderLeft || "0"; + var borderLeft = "0"; + if (window.getComputedStyle) { + borderLeft = window.getComputedStyle(copyObj, null).borderLeft || "0"; + } curleft += parseInt(borderLeft, 10) ; curleft += copyObj.offsetLeft; if(!copyObj.offsetParent) { @@ -334,7 +337,10 @@ Dygraph.findPosY = function(obj) { if(obj.offsetParent) { var copyObj = obj; while(1) { - var borderTop = window.getComputedStyle(copyObj, null).borderTop || "0"; + var borderTop = "0"; + if (window.getComputedStyle) { + borderTop = window.getComputedStyle(copyObj, null).borderTop || "0"; + } curtop += parseInt(borderTop, 10) ; curtop += copyObj.offsetTop; if(!copyObj.offsetParent) {