diff --git a/doc/reference/qweb_templating_language.md b/doc/reference/qweb_templating_language.md index a4709c3b..e2123741 100644 --- a/doc/reference/qweb_templating_language.md +++ b/doc/reference/qweb_templating_language.md @@ -500,6 +500,15 @@ will result in : ``` +This can be used to define variables scoped to a sub template: + +```xml + + + + +``` + ### Translations By default, QWeb specify that templates should be translated. If this behaviour diff --git a/src/misc/portal.ts b/src/misc/portal.ts index 00cd1051..c49af5d4 100644 --- a/src/misc/portal.ts +++ b/src/misc/portal.ts @@ -137,8 +137,7 @@ export class Portal extends Component { } this.__checkVNodeStructure(vnode); const shouldDeploy = - (!this.portal || this.el!.contains(this.portal.elm!)) && - !this.doTargetLookUp; + (!this.portal || this.el!.contains(this.portal.elm!)) && !this.doTargetLookUp; if (!this.doTargetLookUp && !shouldDeploy) { // Only on pure patching, provided the diff --git a/src/qweb/qweb.ts b/src/qweb/qweb.ts index 835bf32b..2305b448 100644 --- a/src/qweb/qweb.ts +++ b/src/qweb/qweb.ts @@ -650,7 +650,7 @@ export class QWeb extends EventBus { if (!name.startsWith("t-") && !(node).getAttribute("t-attf-" + name)) { const attID = ctx.generateID(); if (name === "class") { - if (value = value.trim()) { + if ((value = value.trim())) { let classDef = value .split(/\s+/) .map(a => `'${a}':true`) diff --git a/tests/misc/portal.test.ts b/tests/misc/portal.test.ts index 62da0031..f2d41799 100644 --- a/tests/misc/portal.test.ts +++ b/tests/misc/portal.test.ts @@ -563,16 +563,16 @@ describe("Portal: Basic use and DOM placement", () => { const parent = new Parent(); await parent.mount(fixture); - expect(outside.innerHTML).toBe('gloria'); - expect(parent.el!.innerHTML).toBe(''); + expect(outside.innerHTML).toBe("gloria"); + expect(parent.el!.innerHTML).toBe(""); parent.unmount(); - expect(outside.innerHTML).toBe(''); - expect(parent.el!.innerHTML).toBe('gloria'); + expect(outside.innerHTML).toBe(""); + expect(parent.el!.innerHTML).toBe("gloria"); await parent.mount(fixture); - expect(outside.innerHTML).toBe('gloria'); - expect(parent.el!.innerHTML).toBe(''); + expect(outside.innerHTML).toBe("gloria"); + expect(parent.el!.innerHTML).toBe(""); }); test("portal manual unmount with subcomponent", async () => { @@ -587,7 +587,7 @@ describe("Portal: Basic use and DOM placement", () => { } } class Parent extends Component { - static components = { Portal , Child }; + static components = { Portal, Child }; static template = xml`
@@ -599,16 +599,16 @@ describe("Portal: Basic use and DOM placement", () => { const parent = new Parent(); await parent.mount(fixture); - expect(outside.innerHTML).toBe('gloria'); - expect(parent.el!.innerHTML).toBe(''); + expect(outside.innerHTML).toBe("gloria"); + expect(parent.el!.innerHTML).toBe(""); parent.unmount(); - expect(outside.innerHTML).toBe(''); - expect(parent.el!.innerHTML).toBe('gloria'); + expect(outside.innerHTML).toBe(""); + expect(parent.el!.innerHTML).toBe("gloria"); await parent.mount(fixture); - expect(outside.innerHTML).toBe('gloria'); - expect(parent.el!.innerHTML).toBe(''); + expect(outside.innerHTML).toBe("gloria"); + expect(parent.el!.innerHTML).toBe(""); }); });