From 3ef848ac25e8956f5c13973a964ac5f2f8db0ae5 Mon Sep 17 00:00:00 2001 From: Oliver Sartun Date: Thu, 24 Oct 2013 11:47:45 +0200 Subject: [PATCH] The merge method now makes use of the unregisterAll method --- Backbone.Undo.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Backbone.Undo.js b/Backbone.Undo.js index 0a6e857..86d9b06 100644 --- a/Backbone.Undo.js +++ b/Backbone.Undo.js @@ -706,13 +706,12 @@ if (undoManager instanceof UndoManager && undoManager.stack instanceof UndoStack) { // unregister already registered objects - var registeredObjects = this.objectRegistry.get(), - hasObjects = !!registeredObjects.length; - if (hasObjects) apply(this.unregister, this, registeredObjects); + var registeredObjects = this.objectRegistry.get(); + this.unregisterAll(); // replace the stack reference this.stack = undoManager.stack; // register the just unregistered objects, now on the new stack - if (hasObjects) apply(this.register, this, registeredObjects); + apply(this.register, this, registeredObjects); } }, /**