diff --git a/src/qweb.ts b/src/qweb.ts index 9a5c5cf3..17e24ebc 100644 --- a/src/qweb.ts +++ b/src/qweb.ts @@ -469,7 +469,7 @@ export class QWeb { // dynamic attributes if (name.startsWith("t-att-")) { let attName = name.slice(6); - let formattedValue = this._formatExpression(ctx.getValue(value!)); + let formattedValue = this._formatExpression(ctx.getValue(value!), ctx); const attID = ctx.generateID(); if (!attName.match(/^[a-zA-Z]+$/)) { // attribute contains 'non letters' => we want to quote it diff --git a/tests/__snapshots__/qweb.test.ts.snap b/tests/__snapshots__/qweb.test.ts.snap index a89cb29a..73bc86e9 100644 --- a/tests/__snapshots__/qweb.test.ts.snap +++ b/tests/__snapshots__/qweb.test.ts.snap @@ -99,6 +99,20 @@ exports[`attributes format value 1`] = ` }" `; +exports[`attributes from object variables set previously 1`] = ` +"function anonymous(context,extra +) { + let h = this.utils.h; + let c1 = [], p1 = {key:1}; + let vn1 = h('div', p1, c1); + let _2 = {a:'b'}.a; + let c3 = [], p3 = {key:3,attrs:{class: _2}}; + let vn3 = h('span', p3, c3); + c1.push(vn3); + return vn1; +}" +`; + exports[`attributes from variables set previously 1`] = ` "function anonymous(context,extra ) { diff --git a/tests/qweb.test.ts b/tests/qweb.test.ts index 0461c496..12d05837 100644 --- a/tests/qweb.test.ts +++ b/tests/qweb.test.ts @@ -410,14 +410,11 @@ describe("attributes", () => { expect(result).toBe('