From: Aleksander Ɓukasz Date: Tue, 19 Nov 2013 09:29:09 +0000 (+0100) Subject: smartxml: only send change event when node is currently in a document tree X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/92f4bc991bbd9f8ba67f8dd25d3130845c5c5b72?hp=03a3f51f2a8fd57f90b09a14001e91a4295b5278 smartxml: only send change event when node is currently in a document tree --- diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index 6e754de..0dd7082 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -84,7 +84,9 @@ $.extend(DocumentNode.prototype, { triggerChangeEvent: function(type, metaData) { var event = new events.ChangeEvent(type, $.extend({node: this}, metaData || {})); - this.document.trigger('change', event); + if(type === 'nodeDetached' || this.document.containsNode(event.meta.node)) { + this.document.trigger('change', event); + } }, getNodeInsertion: function(node) {