[FIX] qweb: do not override t-att-class with class

There was some code in qweb to make sure that we support setting class
and t-att-class on the same html element:

<div class="some class" t-att-class="{b: true}">...</div>

But the code did not work in the other direction:

<div t-att-class="{b: true}" class="some class">...</div>

With this commit, we just add the missing if statement

closes #664
This commit is contained in:
Géry Debongnie
2020-04-21 14:59:58 +02:00
committed by aab-odoo
parent 23ce19e57a
commit b5c3422b4d
3 changed files with 27 additions and 2 deletions
+6 -2
View File
@@ -704,8 +704,12 @@ export class QWeb extends EventBus {
.split(/\s+/)
.map(a => `'${escapeQuotes(a)}':true`)
.join(",");
classObj = `_${ctx.generateID()}`;
ctx.addLine(`let ${classObj} = {${classDef}};`);
if (classObj) {
ctx.addLine(`Object.assign(${classObj}, {${classDef}})`);
} else {
classObj = `_${ctx.generateID()}`;
ctx.addLine(`let ${classObj} = {${classDef}};`);
}
}
} else {
ctx.addLine(`let _${attID} = '${escapeQuotes(value)}';`);