X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/b31ffcb46eae55b9c66457e2330b16e8db84f1d6..db58e0a751440706b5e0407e5a4a9ebb6cb0f8aa:/src/smartxml/smartxml.js diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index d9e44be..d42dcbf 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -276,6 +276,9 @@ $.extend(Document.prototype, Backbone.Events, { /* globals document */ from = document.createTextNode(from.text); } else { + if(!from.tagName) { + throw new Error('tagName missing'); + } var node = $('<' + from.tagName + '>'); _.keys(from.attrs || {}).forEach(function(key) { @@ -509,8 +512,10 @@ $.extend(Document.prototype, Backbone.Events, { throw new Error('End of transaction requested, but there is no transaction in progress!'); } this._transactionInProgress = false; - this.undoStack.push(this._transactionStack); - this._transactionStack = []; + if(this._transactionStack.length) { + this.undoStack.push(this._transactionStack); + this._transactionStack = []; + } }, getNodeByPath: function(path) {