support bool values for attribute

This commit is contained in:
Bruno Windels 2019-06-14 22:40:18 +02:00
parent eb2eb291d3
commit 553bda2837

View file

@ -2,7 +2,14 @@ export function setAttribute(el, name, value) {
if (name === "className") {
name = "class";
}
el.setAttribute(name, value);
if (value === false) {
el.removeAttribute(name);
} else {
if (value === true) {
value = name;
}
el.setAttribute(name, value);
}
}
export function el(elementName, attrs, children) {