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 c1be5bd commit a02b0d9
Show file tree
Hide file tree
Showing 2 changed files with 8 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
7 changes: 7 additions & 0 deletions test/dom.test.js
Expand Up @@ -652,3 +652,10 @@ testVdomToHtml("events", [
html: `<button id="clicked"></button>`
}
])

testVdomToHtml("falsey attributes", [
{
vdom: <input spellcheck="false" draggable={false} />,
html: `<input spellcheck="false">`
}
])

0 comments on commit a02b0d9

Please sign in to comment.