diff --git a/static/js/graphing.js b/static/js/graphing.js index 9eeac1909..e5306c487 100644 --- a/static/js/graphing.js +++ b/static/js/graphing.js @@ -186,6 +186,11 @@ ImageHistoryTree.prototype.draw = function(container) { // Save the container. this.container_ = container; + if (!$('#' + container)[0]) { + this.container_ = null; + return; + } + // Create the tree and all its components. var tree = d3.layout.tree() .separation(function() { return 2; }); @@ -193,20 +198,10 @@ ImageHistoryTree.prototype.draw = function(container) { var diagonal = d3.svg.diagonal() .projection(function(d) { return [d.x, d.y]; }); - var rootSvg = d3.select("#" + container).append("svg:svg") + var rootSvg = d3.select("#" + container).append("svg:svg") .attr("class", "image-tree"); - if (!rootSvg) { - this.container_ = null; - return; - } - var vis = rootSvg.append("svg:g"); - if (!vis) { - this.container_ = null; - return; - } - var formatComment = this.formatComment_; var formatTime = this.formatTime_; var formatCommand = this.formatCommand_;