fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
smartxml: raise an Error on invalid XML
[fnpeditor.git]
/
src
/
wlxml
/
wlxml.js
diff --git
a/src/wlxml/wlxml.js
b/src/wlxml/wlxml.js
index
a320da3
..
820b95f
100644
(file)
--- a/
src/wlxml/wlxml.js
+++ b/
src/wlxml/wlxml.js
@@
-9,13
+9,6
@@
define([
/* globals Node */
/* globals Node */
-// utils
-
-var isMetaAttribute = function(attrName) {
- return attrName.substr(0, 5) === 'meta-';
-};
-
-//
var AttributesList = function() {};
AttributesList.prototype = Object.create({});
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) {
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) {
}.bind(this));
}
}.bind(this));
return toret;
},
setMetaAttribute: function(key, value) {
- this.setAttr(
'meta-'+
key, value);
+ this.setAttr(key, value);
},
getOtherAttributes: function() {
},
getOtherAttributes: function() {
- var toret = {};
+ var toret = {},
+ node = this;
this.getAttrs().forEach(function(attr) {
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;
},
}
});
return toret;
},
+ isMetaAttribute: function(attrName) {
+ return attrName !== 'class' &&_.contains(_.keys(this.getMetaAttributes()), attrName);
+ },
_getXMLDOMToDump: function() {
var DOM = this._$.clone(true, true);
_getXMLDOMToDump: function() {
var DOM = this._$.clone(true, true);
@@
-289,8
+286,8
@@
$.extend(WLXMLDocument.prototype, {
});
var wlxmlClasses = {
});
var wlxmlClasses = {
- '
uri
': {
- attrs: {
uri
: {type: 'string'}}
+ '
link
': {
+ attrs: {
href
: {type: 'string'}}
}
};
}
};