[FIX] qweb: bind handlers to component

Before this commit, the handlers were bound to the current context,
which is often the component but not necessarily.  In some cases, a sub
scope can be created (with t-foreach, or slots, or t-call), and the
context is actually an object with the actual component instance it its
prototype chain, but not the component.
This commit is contained in:
Géry Debongnie
2019-12-12 11:21:49 +01:00
committed by aab-odoo
parent 4e22dbcad6
commit 0931a4dc5b
11 changed files with 208 additions and 41 deletions
+7 -1
View File
@@ -279,7 +279,13 @@ QWeb.addDirective({
}
let eventsCode = events
.map(function([name, value]) {
const { event, handler } = makeHandlerCode(ctx, name, value, false, T_COMPONENT_MODS_CODE);
const { event, handler } = makeHandlerCode(
ctx,
name,
value,
false,
T_COMPONENT_MODS_CODE
);
return `vn.elm.addEventListener('${event}', ${handler});`;
})
.join("");