diff --git a/web/static/src/ts/core/qweb_vdom.ts b/web/static/src/ts/core/qweb_vdom.ts index 503109f2..49b41a07 100644 --- a/web/static/src/ts/core/qweb_vdom.ts +++ b/web/static/src/ts/core/qweb_vdom.ts @@ -406,12 +406,20 @@ export class QWeb { // dynamic attributes if (name.startsWith("t-att-")) { let attName = name.slice(6); - const formattedValue = this._formatExpression(ctx.getValue(value!)); + let formattedValue = this._formatExpression(ctx.getValue(value!)); const attID = ctx.generateID(); if (!attName.match(/^[a-zA-Z]+$/)) { // attribute contains 'non letters' => we want to quote it attName = '"' + attName + '"'; } + // we need to combine dynamic with non dynamic attributes: + // class="a" t-att-class="'yop'" should be rendered as class="a yop" + const attValue = (node).getAttribute(attName); + if (attValue) { + const attValueID = ctx.generateID(); + ctx.addLine(`let _${attValueID} = ${formattedValue};`); + formattedValue = `'${attValue}' + (_${attValueID} ? ' ' + _${attValueID} : '')`; + } ctx.addLine(`let _${attID} = ${formattedValue};`); attrs.push(`${attName}: _${attID}`); } diff --git a/web/static/src/xml/templates.xml b/web/static/src/xml/templates.xml index aa228409..f5579cc5 100644 --- a/web/static/src/xml/templates.xml +++ b/web/static/src/xml/templates.xml @@ -11,8 +11,8 @@
Loading
-
- +