guard window.getComputedStyle call for IE8
authorDan Vanderkam <danvk@google.com>
Wed, 20 Feb 2013 01:18:54 +0000 (20:18 -0500)
committerDan Vanderkam <danvk@google.com>
Wed, 20 Feb 2013 01:18:54 +0000 (20:18 -0500)
dygraph-utils.js

index 6aa7dfc..8c6942b 100644 (file)
@@ -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) {