From: Dan Vanderkam Date: Tue, 14 Sep 2010 00:15:54 +0000 (-0700) Subject: fix some style bugs X-Git-Tag: v1.0.0~667 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=18a016b15788a68e2ca5c1cfb7b794926b5a193d;p=dygraphs.git fix some style bugs --- 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;";