X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/2e56014376cdf6998d2dd76e07fe05c1f6a12574..25175ece1135d9757fb1e5782c20d12ba804a0d4:/src/wlxml/wlxml.js diff --git a/src/wlxml/wlxml.js b/src/wlxml/wlxml.js index a320da3..820b95f 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); @@ -289,8 +286,8 @@ $.extend(WLXMLDocument.prototype, { }); var wlxmlClasses = { - 'uri': { - attrs: {uri: {type: 'string'}} + 'link': { + attrs: {href: {type: 'string'}} } };