Skip to content

Commit 3721e39

Browse files
committed
setAttr(): remove key === "is", fixes MithrilJS#2799
1 parent af65b2d commit 3721e39

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

render/render.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ module.exports = function() {
676676
}
677677
}
678678
function setAttr(vnode, key, old, value, ns) {
679-
if (key === "key" || key === "is" || value == null || isLifecycleMethod(key) || (old === value && !isFormAttribute(vnode, key)) && typeof value !== "object") return
679+
if (key === "key" || value == null || isLifecycleMethod(key) || (old === value && !isFormAttribute(vnode, key)) && typeof value !== "object") return
680680
if (key[0] === "o" && key[1] === "n") return updateEvent(vnode, key, value)
681681
if (key.slice(0, 6) === "xlink:") vnode.dom.setAttributeNS("http://www.w3.org/1999/xlink", key.slice(6), value)
682682
else if (key === "style") updateStyle(vnode.dom, old, value)

render/tests/test-attributes.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ o.spec("attributes", function() {
8080
o(spies[0].callCount).equals(0)
8181
o(spies[2].callCount).equals(0)
8282
o(spies[3].calls).deepEquals([{this: spies[3].elem, args: ["custom", "x"]}])
83-
o(spies[4].calls).deepEquals([{this: spies[4].elem, args: ["custom", "x"]}])
84-
o(spies[5].calls).deepEquals([{this: spies[5].elem, args: ["custom", "x"]}])
83+
o(spies[4].calls).deepEquals([{this: spies[4].elem, args: ["is", "something-special"]} ,{this: spies[4].elem, args: ["custom", "x"]}])
84+
o(spies[5].calls).deepEquals([{this: spies[5].elem, args: ["is", "something-special"]} ,{this: spies[5].elem, args: ["custom", "x"]}])
8585
})
8686

8787
o("when vnode is customElement with property, custom setAttribute not called", function(){
@@ -124,8 +124,8 @@ o.spec("attributes", function() {
124124
o(spies[1].callCount).equals(0)
125125
o(spies[2].callCount).equals(0)
126126
o(spies[3].callCount).equals(0)
127-
o(spies[4].callCount).equals(0)
128-
o(spies[5].callCount).equals(0)
127+
o(spies[4].callCount).equals(1) // setAttribute("is", "something-special") is called
128+
o(spies[5].callCount).equals(1) // setAttribute("is", "something-special") is called
129129
o(getters[0].callCount).equals(0)
130130
o(getters[1].callCount).equals(0)
131131
o(getters[2].callCount).equals(0)

0 commit comments

Comments
 (0)