X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/295c9ced8e77df8e0d83951159d3c3c416771753..1dfb9c497ad66a5c0025e806bd6ee4777baaf1aa:/src/smartxml/smartxml.js?ds=inline diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index 8bf531b..d085742 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -203,6 +203,10 @@ $.extend(ElementNode.prototype, { return toret; }, + containsNode: function(node) { + return node && (node.nativeNode === this.nativeNode || node._$.parents().index(this._$) !== -1); + }, + toXML: function() { var wrapper = $('
'); wrapper.append(this._getXMLDOMToDump()); @@ -354,7 +358,7 @@ $.extend(Document.prototype, Backbone.Events, { }, containsNode: function(node) { - return this.root && (node.nativeNode === this.root.nativeNode || node._$.parents().index(this.root._$) !== -1); + return this.root && this.root.containsNode(node); }, getSiblingParents: function(params) { @@ -570,6 +574,12 @@ $.extend(Document.prototype, Backbone.Events, { } }, + transaction: function(callback, context) { + this.startTransaction(); + callback.call(context); + this.endTransaction(); + }, + getNodeByPath: function(path) { var toret = this.root; path.forEach(function(idx) {