mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
support bool values for attribute
This commit is contained in:
parent
eb2eb291d3
commit
553bda2837
@ -2,7 +2,14 @@ export function setAttribute(el, name, value) {
|
|||||||
if (name === "className") {
|
if (name === "className") {
|
||||||
name = "class";
|
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) {
|
export function el(elementName, attrs, children) {
|
||||||
|
Loading…
Reference in New Issue
Block a user