From: Aleksander Ɓukasz Date: Wed, 15 Jan 2014 14:58:19 +0000 (+0100) Subject: smartxml: allow for registering extensions before initial xml processing X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/bd0c9397ecd0cccdc7af0f0b0153adf5126e1538 smartxml: allow for registering extensions before initial xml processing --- diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index 000f722..e525c14 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -260,8 +260,7 @@ var registerMethod = function(methodName, method, target) { }; -var Document = function(xml) { - this.loadXML(xml); +var Document = function(xml, extensions) { this.undoStack = []; this.redoStack = []; this._transactionStack = []; @@ -275,6 +274,11 @@ var Document = function(xml) { this._elementNodeTransformations = {}; this.registerExtension(coreTransformations); + + (extensions || []).forEach(function(extension) { + this.registerExtension(extension); + }.bind(this)); + this.loadXML(xml); }; $.extend(Document.prototype, Backbone.Events, {