Fix: For css class addition to svg elements

This commit is contained in:
Gyandeep Singh 2016-05-10 16:29:42 -05:00
parent 3666aa747e
commit f1f77c80b3
2 changed files with 12 additions and 1 deletions

View file

@ -358,7 +358,9 @@ module.exports = function($window, onevent) {
if (value) element.setAttribute(key, "")
else element.removeAttribute(key)
}
else element.setAttribute(key, value)
else element.setAttribute(
key === "className" ? "class" : key,
value)
}
}
function setLateAttrs(vnode) {

View file

@ -76,4 +76,13 @@ o.spec("attributes", function() {
o(a.dom.attributes["href"]).equals(undefined)
})
})
o.spec("svg class", function() {
o("when className is specified then it should be added as a class", function() {
var a = {tag: "svg", attrs: {className: "test"}}
render(root, [a]);
o(a.dom.attributes.class.nodeValue).equals("test")
})
})
})