From 92f4bc991bbd9f8ba67f8dd25d3130845c5c5b72 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Tue, 19 Nov 2013 10:29:09 +0100 Subject: [PATCH] smartxml: only send change event when node is currently in a document tree --- src/smartxml/smartxml.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) { -- 2.20.1