if(klass != this.getClass()) {
var c = this;
this.getMetaAttrs().forEach(function(attr) {
- c.dom.removeAttr('wlxml-meta-' + attr.name);
+ if(!classAttributes.hasMetaAttr(klass, attr.name))
+ c.dom.removeAttr('wlxml-meta-' + attr.name);
});
this.dom.attr('wlxml-class', klass);
}
assert.equal(node.getMetaAttr('uri'), undefined);
});
+
+ test('changing class to another with the same attribute keeps the value', function() {
+ var node = canvasNode.create({tag: 'span', klass: 'uri', meta: {uri: 'http://some.uri.com'}});
+ assert.equal(node.getMetaAttr('uri'), 'http://some.uri.com');
+ node.setClass('uri-subclass');
+ assert.equal(node.getMetaAttr('uri'), 'http://some.uri.com');
+ });
});
});
\ No newline at end of file