Skip to content

Commit

Permalink
Falsey attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzzy committed Mar 1, 2018
1 parent a6eec2b commit ee94ef1
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 @@ -153,7 +153,7 @@ export function app(state, actions, view, container) {
typeof value === "function" ||
(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 @@ -767,3 +767,13 @@ testTreeSegue("input list attribute", [
html: `<input list="foobar">`
}
])

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

0 comments on commit ee94ef1

Please sign in to comment.