X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/fb23a597811c4c60dd1b9bddeab4335a33bee8c1..cb5f162babe577ede5a113b49d072b51a97ecaad:/src/wlxml/wlxml.js diff --git a/src/wlxml/wlxml.js b/src/wlxml/wlxml.js index a320da3..7f6e931 100644 --- a/src/wlxml/wlxml.js +++ b/src/wlxml/wlxml.js @@ -9,13 +9,6 @@ define([ /* globals Node */ -// utils - -var isMetaAttribute = function(attrName) { - return attrName.substr(0, 5) === 'meta-'; -}; - -// var AttributesList = function() {}; AttributesList.prototype = Object.create({}); @@ -62,24 +55,28 @@ $.extend(WLXMLElementNode.prototype, smartxml.ElementNode.prototype, { classDesc = this.document.options.wlxmlClasses[classCurrent]; if(classDesc) { _.keys(classDesc.attrs).forEach(function(attrName) { - toret[attrName] = _.extend({value: this.getAttr('meta-' + attrName)}, classDesc.attrs[attrName]); + toret[attrName] = _.extend({value: this.getAttr(attrName)}, classDesc.attrs[attrName]); }.bind(this)); } }.bind(this)); return toret; }, setMetaAttribute: function(key, value) { - this.setAttr('meta-'+key, value); + this.setAttr(key, value); }, getOtherAttributes: function() { - var toret = {}; + var toret = {}, + node = this; this.getAttrs().forEach(function(attr) { - if(attr.name !== 'class' && !isMetaAttribute(attr.name)) { - toret[attr.name] = attr.value; + if(attr.name !== 'class' && !node.isMetaAttribute(attr.name)) { + toret[attr.name] = {value: attr.value}; } }); return toret; }, + isMetaAttribute: function(attrName) { + return attrName !== 'class' &&_.contains(_.keys(this.getMetaAttributes()), attrName); + }, _getXMLDOMToDump: function() { var DOM = this._$.clone(true, true);