From 8a870376bb9712b8fa111e1908802084836f68f2 Mon Sep 17 00:00:00 2001 From: Robert Konigsberg Date: Thu, 22 Nov 2012 12:55:03 -0500 Subject: [PATCH] When div is of type string, replace it with a document element. --- dygraph.js | 4 ++++ 1 file changed, 4 insertions(+) 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; -- 2.7.4