Skip to content

Commit

Permalink
vnode.attrs is never null
Browse files Browse the repository at this point in the history
  • Loading branch information
barneycarroll authored and StephanHoyer committed Feb 12, 2022
1 parent e4c6621 commit f9e5163
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion render/hyperscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function execSelector(state, vnode) {
var className = hasClass ? attrs.class : attrs.className

vnode.tag = state.tag
vnode.attrs = null
vnode.attrs = {}

if (!isEmpty(state.attrs) && !isEmpty(attrs)) {
var newAttrs = {}
Expand Down
10 changes: 5 additions & 5 deletions render/tests/test-hyperscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ o.spec("hyperscript", function() {
var vnode = m("div", {key:"a"})

o(vnode.tag).equals("div")
o(vnode.attrs).equals(null)
o(vnode.attrs).deepEquals({})
o(vnode.key).equals("a")
})
o("handles many attrs", function() {
Expand Down Expand Up @@ -343,7 +343,7 @@ o.spec("hyperscript", function() {
var vnode = m("custom-element", {key:"a"})

o(vnode.tag).equals("custom-element")
o(vnode.attrs).equals(null)
o(vnode.attrs).deepEquals({})
o(vnode.key).equals("a")
})
o("handles many attrs", function() {
Expand Down Expand Up @@ -551,20 +551,20 @@ o.spec("hyperscript", function() {
o("handles children without attr", function() {
var vnode = m("div", [m("i"), m("s")])

o(vnode.attrs).equals(null)
o(vnode.attrs).deepEquals({})
o(vnode.children[0].tag).equals("i")
o(vnode.children[1].tag).equals("s")
})
o("handles child without attr unwrapped", function() {
var vnode = m("div", m("i"))

o(vnode.attrs).equals(null)
o(vnode.attrs).deepEquals({})
o(vnode.children[0].tag).equals("i")
})
o("handles children without attr unwrapped", function() {
var vnode = m("div", m("i"), m("s"))

o(vnode.attrs).equals(null)
o(vnode.attrs).deepEquals({})
o(vnode.children[0].tag).equals("i")
o(vnode.children[1].tag).equals("s")
})
Expand Down

0 comments on commit f9e5163

Please sign in to comment.