From: Robert Konigsberg Date: Thu, 22 Nov 2012 17:55:03 +0000 (-0500) Subject: When div is of type string, replace it with a document element. X-Git-Tag: v1.0.0~169^2~1 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=8a870376bb9712b8fa111e1908802084836f68f2;p=dygraphs.git When div is of type string, replace it with a document element. --- diff --git a/dygraph.js b/dygraph.js index c7f7087..42e87c8 100644 --- a/dygraph.js +++ b/dygraph.js @@ -355,6 +355,10 @@ Dygraph.prototype.__init__ = function(div, file, attrs) { attrs = Dygraph.mapLegacyOptions_(attrs); + if (typeof(div) == 'string') { + div = document.getElementById(div); + } + if (!div) { Dygraph.error("Constructing dygraph with a non-existent div!"); return;