diff --git a/web/static/src/ts/core/qweb_vdom.ts b/web/static/src/ts/core/qweb_vdom.ts index eb5f985d..d6637194 100644 --- a/web/static/src/ts/core/qweb_vdom.ts +++ b/web/static/src/ts/core/qweb_vdom.ts @@ -192,6 +192,9 @@ export class QWeb { const doc = this.parsedTemplates[name]; const ctx = new Context(); + // this is necessary to prevent some directives (t-forach for ex) to + // pollute the rendering context by adding some keys in it. + ctx.addLine("context = Object.create(context)"); const mainNode = doc.firstChild!; this._compileNode(mainNode, ctx); diff --git a/web/static/tests/qweb_vdom.test.ts b/web/static/tests/qweb_vdom.test.ts index d19dc9f1..839dc66c 100644 --- a/web/static/tests/qweb_vdom.test.ts +++ b/web/static/tests/qweb_vdom.test.ts @@ -566,6 +566,19 @@ describe("foreach", () => { const expected = `