Fixed bug in Graph.prototype.merge

Was using 'graph' var instead of 'this'.. thanks to Nessia for reporting this.
This commit is contained in:
Dennis Hotson 2011-06-22 09:21:14 +10:00
parent 15dbcf89d5
commit 3662393702

View File

@ -196,7 +196,7 @@ Graph.prototype.merge = function(data)
{
var nodes = [];
data.nodes.forEach(function(n) {
nodes.push(graph.addNode(new Node(n.id, n.data)));
nodes.push(this.addNode(new Node(n.id, n.data)));
}, this);
data.edges.forEach(function(e) {
@ -209,7 +209,7 @@ Graph.prototype.merge = function(data)
? e.type + "-" + from.id + "-" + to.id
: e.type + "-" + to.id + "-" + from.id;
var edge = graph.addEdge(new Edge(id, from, to, e.data));
var edge = this.addEdge(new Edge(id, from, to, e.data));
edge.data.type = e.type;
}, this);
};