X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/0f5cbf957bc0bbdcff93bdb33c227f78041e332b..9b1b7497ad65a4f8ef9053bcd6aac025027dd4f6:/src/wlxml/wlxml.js diff --git a/src/wlxml/wlxml.js b/src/wlxml/wlxml.js index b560982..13522ba 100644 --- a/src/wlxml/wlxml.js +++ b/src/wlxml/wlxml.js @@ -268,19 +268,7 @@ $.extend(WLXMLDocument.prototype, { registerExtension: function(extension) { //debugger; smartxml.Document.prototype.registerExtension.call(this, extension); - var doc = this, - existingPropertyNames = _.values(this); - - var getTrans = function(desc, methodName) { - if(typeof desc === 'function') { - desc = {impl: desc}; - } - if(!desc.impl) { - throw new Error('Got transformation description without implementation.') - } - desc.name = desc.name || methodName; - return desc; - }; + var doc = this; _.pairs(extension.wlxmlClass).forEach(function(pair) { var className = pair[0], @@ -293,8 +281,9 @@ $.extend(WLXMLDocument.prototype, { }); _.pairs(classExtension.transformations || {}).forEach(function(pair) { - var transformation = getTrans(pair[1], pair[0]); - doc.registerClassTransformation(transformations.createContextTransformation(transformation), className); + var name = pair[0], + desc = pair[1]; + doc.registerClassTransformation(transformations.createContextTransformation(desc, name), className); }); });