mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] blockdom: fix crash when class object key has leading spaces
Previously, having a leading or trailing space caused HTMLElement.classList.add to be called with an empty string (because we are splitting on whitespace), which is not allowed and caused a crash. This commit fixes that by trimming the keys of the class object in the same way that we already do it for class strings.
This commit is contained in:
committed by
Géry Debongnie
parent
2e03332acd
commit
e57e2ee378
@@ -93,6 +93,10 @@ function toClassObj(expr: string | number | { [c: string]: any }) {
|
||||
for (let key in expr as any) {
|
||||
const value = (expr as any)[key];
|
||||
if (value) {
|
||||
key = trim.call(key);
|
||||
if (!key) {
|
||||
continue;
|
||||
}
|
||||
const words = split.call(key, wordRegexp);
|
||||
for (let word of words) {
|
||||
result[word] = value;
|
||||
|
||||
Reference in New Issue
Block a user