From: Dan Vanderkam Date: Thu, 11 Nov 2010 23:14:49 +0000 (-0500) Subject: hack to be more robust in IE when instantiated while the page is still loading X-Git-Tag: v1.0.0~605 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=a2c8fff4d974db18841de1cbfe691979d3ef2a94;p=dygraphs.git hack to be more robust in IE when instantiated while the page is still loading --- diff --git a/dygraph.js b/dygraph.js index 5cfe2f4..c24f4f3 100644 --- a/dygraph.js +++ b/dygraph.js @@ -166,6 +166,16 @@ Dygraph.prototype.__old_init__ = function(div, file, labels, attrs) { * @private */ Dygraph.prototype.__init__ = function(div, file, attrs) { + // Hack for IE: if we're using excanvas and the document hasn't finished + // loading yet (and hence may not have initialized whatever it needs to + // initialize), then keep calling this routine periodically until it has. + if (/MSIE/.test(navigator.userAgent) && !window.opera && + typeof(G_vmlCanvasManager) != 'undefined' && + document.readyState != 'complete') { + var self = this; + setTimeout(function() { self.__init__(div, file, attrs) }, 100); + } + // Support two-argument constructor if (attrs == null) { attrs = {}; }