Merge pull request #1395 from ornicar/update-node-ns

Add failing test and proposed fix for SVG update with tag change.
This commit is contained in:
Leo Horie 2016-11-13 08:17:18 -05:00 committed by GitHub
commit 0308140156
2 changed files with 14 additions and 1 deletions

View file

@ -213,7 +213,7 @@ module.exports = function($window) {
}
else {
removeNode(old, null)
insertNode(parent, createNode(vnode, hooks, undefined), nextSibling)
insertNode(parent, createNode(vnode, hooks, ns), nextSibling)
}
}
function updateText(old, vnode) {

View file

@ -211,6 +211,19 @@ o.spec("updateElement", function() {
o(updated.dom.attributes["class"].nodeValue).equals("b")
})
o("updates svg child", function() {
var vnode = {tag: "svg", children: [{
tag: 'circle'
}]}
var updated = {tag: "svg", children: [{
tag: 'line'
}]}
render(root, [vnode])
render(root, [updated])
o(updated.dom.firstChild.namespaceURI).equals("http://www.w3.org/2000/svg")
})
o("restores correctly when recycling", function() {
var vnode = {tag: "div", key: 1}
var updated = {tag: "div", key: 2}