From bd0c9397ecd0cccdc7af0f0b0153adf5126e1538 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Wed, 15 Jan 2014 15:58:19 +0100 Subject: [PATCH 1/1] smartxml: allow for registering extensions before initial xml processing --- src/smartxml/smartxml.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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, { -- 2.20.1