diff --git a/render/hyperscript.js b/render/hyperscript.js index 26ff753e..0015b26e 100644 --- a/render/hyperscript.js +++ b/render/hyperscript.js @@ -38,7 +38,7 @@ function execSelector(state, vnode) { vnode.tag = state.tag vnode.attrs = {} - if (!isEmpty(state.attrs) && !isEmpty(attrs)) { + if (!isEmpty(state.attrs)) { var newAttrs = {} for (var key in attrs) { diff --git a/render/tests/test-hyperscript.js b/render/tests/test-hyperscript.js index 59751f44..fcf69d25 100644 --- a/render/tests/test-hyperscript.js +++ b/render/tests/test-hyperscript.js @@ -580,6 +580,15 @@ o.spec("hyperscript", function() { o(nodeB.attrs.className).equals("b") o(nodeB.attrs.a).equals("b") }) + o("handles shared empty attrs (#2821)", function() { + var attrs = {} + + var nodeA = m(".a", attrs) + var nodeB = m(".b", attrs) + + o(nodeA.attrs.className).equals("a") + o(nodeB.attrs.className).equals("b") + }) o("doesnt modify passed attributes object", function() { var attrs = {a: "b"} m(".a", attrs)