hyperscript: handles shared empty attrs, fixes #2821

This commit is contained in:
Keita Furui 2023-02-15 11:11:18 +09:00 committed by Claudia Meadows
parent a1159b71c0
commit 88da9e56f9
2 changed files with 10 additions and 1 deletions

View file

@ -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)