fix class removal
This commit is contained in:
parent
f0888ac7bd
commit
b9244f4c21
2 changed files with 12 additions and 0 deletions
|
|
@ -431,6 +431,7 @@ module.exports = function($window) {
|
|||
if (old != null) {
|
||||
for (var key in old) {
|
||||
if (attrs == null || !(key in attrs)) {
|
||||
if (key === "className") key = "class"
|
||||
if (key[0] === "o" && key[1] === "n" && !isLifecycleMethod(key)) updateEvent(vnode, key, undefined)
|
||||
else if (key !== "key") vnode.dom.removeAttribute(key)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,17 @@ o.spec("updateElement", function() {
|
|||
o(updated.dom).equals(root.firstChild)
|
||||
o("title" in updated.dom.attributes).equals(false)
|
||||
})
|
||||
o("removes class", function() {
|
||||
var vnode = {tag: "a", attrs: {id: "b", className: "d"}}
|
||||
var updated = {tag: "a", attrs: {id: "c"}}
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
o(updated.dom).equals(vnode.dom)
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o("class" in updated.dom.attributes).equals(false)
|
||||
})
|
||||
o("creates style object", function() {
|
||||
var vnode = {tag: "a", attrs: {}}
|
||||
var updated = {tag: "a", attrs: {style: {backgroundColor: "green"}}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue