Make sure that we only save the tree reference if we have actually rendered it (properly this time, since apparently d3 will append to.. nothing…)
This commit is contained in:
parent
8da4104e7b
commit
e336185a22
1 changed files with 6 additions and 11 deletions
|
@ -186,6 +186,11 @@ ImageHistoryTree.prototype.draw = function(container) {
|
||||||
// Save the container.
|
// Save the container.
|
||||||
this.container_ = container;
|
this.container_ = container;
|
||||||
|
|
||||||
|
if (!$('#' + container)[0]) {
|
||||||
|
this.container_ = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Create the tree and all its components.
|
// Create the tree and all its components.
|
||||||
var tree = d3.layout.tree()
|
var tree = d3.layout.tree()
|
||||||
.separation(function() { return 2; });
|
.separation(function() { return 2; });
|
||||||
|
@ -196,17 +201,7 @@ ImageHistoryTree.prototype.draw = function(container) {
|
||||||
var rootSvg = d3.select("#" + container).append("svg:svg")
|
var rootSvg = d3.select("#" + container).append("svg:svg")
|
||||||
.attr("class", "image-tree");
|
.attr("class", "image-tree");
|
||||||
|
|
||||||
if (!rootSvg) {
|
|
||||||
this.container_ = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var vis = rootSvg.append("svg:g");
|
var vis = rootSvg.append("svg:g");
|
||||||
if (!vis) {
|
|
||||||
this.container_ = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var formatComment = this.formatComment_;
|
var formatComment = this.formatComment_;
|
||||||
var formatTime = this.formatTime_;
|
var formatTime = this.formatTime_;
|
||||||
var formatCommand = this.formatCommand_;
|
var formatCommand = this.formatCommand_;
|
||||||
|
|
Reference in a new issue