X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/1483497645590e1d63143d686c3f4455f9503b82..3c6c8fe1de117ec69a146ea18aedac5d8dc30691:/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); }); });