+ function getXNodeAttributes(node) {
+ var m = {}
+ $.map(node.attributes, function(attrNode) {
+ if (attrNode.nodeName.startsWith('data-wlf-')) {
+ var n = attrNode.nodeName.substr(9);
+ var v = attrNode.nodeValue;
+ m[n] = v;
+ };
+ });
+ return m;
+ }
+
+ function setXNodeAttributes(node, attrs) {
+ $.map(node.attributes, function(attrNode) {
+ var xName = attrNode.nodeName.substr(9);
+ if (attrNode.nodeName.startsWith('data-wlf-')
+ && xName in attrs) {
+ attrNode.nodeValue = attrs[xName];
+ }
+ if (attrNode.nodeName.startsWith('x-attr-name-')
+ && attrNode.nodeValue in attrs) {
+ node.setAttribute('x-attr-value-' + attrNode.nodeName.substr("x-attr-name-".length),
+ attrs[attrNode.nodeValue]);
+ }
+ });
+ }
+