Merge pull request #1041 from gyandeeps/patch-1

Fix: For css class addition to svg elements
This commit is contained in:
Leo Horie 2016-05-11 11:49:55 -04:00
commit 76818dab24
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")
})
})
})