allow non alphanumeric dynamic attributes in qweb

This commit is contained in:
Géry Debongnie
2019-02-06 11:27:25 +01:00
parent 7b5610802a
commit e398ee2668
3 changed files with 23 additions and 2 deletions
+5 -1
View File
@@ -384,9 +384,13 @@ export class QWeb {
// dynamic attributes
if (name.startsWith("t-att-")) {
const attName = name.slice(6);
let attName = name.slice(6);
const 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 + '"';
}
ctx.addLine(`let _${attID} = ${formattedValue};`);
attrs.push(`${attName}: _${attID}`);
}