[FIX] blockdom: t-att- correcltly sets the value to zero

In 3536f41f00 we added a fallback when setting a
property to a falsy value so that the property was set to the empty string. The
objective being to not get the string "undefined"/"null"/"false" as property
value. However, using t-att- to set a property to 0 is perfectly reasonable and
in fact quite common.
This commit is contained in:
Samuel Degueldre
2022-03-18 14:04:04 +01:00
committed by aab-odoo
parent 77ff5ee895
commit d277039b14
2 changed files with 15 additions and 2 deletions
+2 -1
View File
@@ -139,7 +139,8 @@ export function updateClass(this: HTMLElement, val: any, oldVal: any) {
export function makePropSetter(name: string): Setter<HTMLElement> {
return function setProp(this: HTMLElement, value: any) {
(this as any)[name] = value || "";
// support 0, fallback to empty string for other falsy values
(this as any)[name] = value === 0 ? 0 : value || "";
};
}