From a2c8fff4d974db18841de1cbfe691979d3ef2a94 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Thu, 11 Nov 2010 18:14:49 -0500 Subject: [PATCH] hack to be more robust in IE when instantiated while the page is still loading --- dygraph.js | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 = {}; } -- 2.7.4