diff --git a/js/id/graph/graph.js b/js/id/graph/graph.js index cb81b2e6c..f9b2c7ab6 100644 --- a/js/id/graph/graph.js +++ b/js/id/graph/graph.js @@ -156,9 +156,12 @@ iD.Graph.prototype = { }, difference: function (graph) { - var result = [], entity, oldentity, id; + var result = [], + keys = Object.keys(this.entities), + entity, oldentity, id; - for (id in this.entities) { + for (var i = 0; i < keys.length; i++) { + id = keys[i]; entity = this.entities[id]; oldentity = graph.entities[id]; if (entity !== oldentity) { @@ -180,7 +183,9 @@ iD.Graph.prototype = { } } - for (id in graph.entities) { + keys = Object.keys(graph.entities); + for (var i = 0; i < keys.length; i++) { + id = keys[i]; entity = graph.entities[id]; if (entity && !this.entities.hasOwnProperty(id)) { result.push(id); @@ -213,5 +218,9 @@ iD.Graph.prototype = { if (!entity) result.push(id); }); return result; + }, + + reset: function() { + iD.Graph.prototype.original = {}; } }; diff --git a/js/id/graph/history.js b/js/id/graph/history.js index f6377355f..c6636f796 100644 --- a/js/id/graph/history.js +++ b/js/id/graph/history.js @@ -128,6 +128,7 @@ iD.History = function() { }, reset: function () { + iD.Graph.prototype.reset(); stack = [{graph: iD.Graph()}]; index = 0; dispatch.change();