From 18a016b15788a68e2ca5c1cfb7b794926b5a193d Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Mon, 13 Sep 2010 17:15:54 -0700 Subject: [PATCH] fix some style bugs --- dygraph.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dygraph.js b/dygraph.js index e8afb2b..2c0e202 100644 --- a/dygraph.js +++ b/dygraph.js @@ -2363,7 +2363,19 @@ Dygraph.prototype.annotations = function() { Dygraph.addAnnotationRule = function() { if (Dygraph.addedAnnotationCSS) return; - var mysheet=document.styleSheets[0] + var mysheet; + if (document.styleSheets.length > 0) { + mysheet = document.styleSheets[0]; + } else { + var styleSheetElement = document.createElement("style"); + styleSheetElement.type = "text/css"; + document.getElementsByTagName("head")[0].appendChild(styleSheetElement); + for(i = 0; i < document.styleSheets.length; i++) { + if (document.styleSheets[i].disabled) continue; + mysheet = document.styleSheets[i]; + } + } + var rule = "border: 1px solid black; " + "background-color: white; " + "text-align: center;"; -- 2.7.4