fix: fixed bad use of get/hasAttribute

This commit is contained in:
Daniel Ledda
2022-04-03 12:51:45 +02:00
parent bf0a98c5aa
commit c522666927

View File

@@ -69,18 +69,10 @@ export function h<
const attribute = (attributes as any)[key]; const attribute = (attributes as any)[key];
if (attribute) { if (attribute) {
if (attribute instanceof Ref) { if (attribute instanceof Ref) {
if (element.hasAttribute(key)) { (element as any)[key] = attribute.val;
element.setAttribute(key, attribute.val); attribute.watch((newVal) => (element as any)[key] = newVal);
attribute.watch((newVal) => {
if (element.hasAttribute(key)) {
element.setAttribute(key, newVal);
}
});
}
} else { } else {
if (element.hasAttribute(key)) { (element as any)[key] = attribute;
element.setAttribute(key, attribute);
}
} }
} }
} }