Skip to content

Commit

Permalink
Falsey attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzzy committed Mar 8, 2018
1 parent fa8fdd3 commit 975f203
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -161,7 +161,7 @@ export function app(state, actions, view, container) {
element.removeEventListener(name, eventListener)
}
} else if (name in element && name !== "list" && !isSvg) {
element[name] = value == null ? "" : value
element[name] = value == null || value === "false" ? "" : value
} else if (value != null && value !== false) {
element.setAttribute(name, value)
}
Expand Down
10 changes: 10 additions & 0 deletions test/dom.test.js
Expand Up @@ -784,3 +784,13 @@ test("event handlers", done => {
document.body
)
})

testTreeSegue("falsey attributes", [
{
tree: h("input", {
spellcheck: "false",
draggable: "false"
}),
html: `<input spellcheck="false" draggable="false">`
}
])

0 comments on commit 975f203

Please sign in to comment.