[IMP] qweb: throw error when t-component is not used with a 't' tag

This commit is contained in:
Mathieu Duckerts-Antoine
2021-10-19 16:01:36 +02:00
committed by Aaron Bohy
parent 52fa81c510
commit d569ea1c28
3 changed files with 5 additions and 17 deletions
+4
View File
@@ -645,6 +645,10 @@ function parseComponent(node: Element, ctx: ParsingContext): AST | null {
const firstLetter = name[0];
let isDynamic = node.hasAttribute("t-component");
if (isDynamic && name !== "t") {
throw new Error(`Directive 't-component' can only be used on <t> nodes (used on a <${name}>)`);
}
if (!(firstLetter === firstLetter.toUpperCase() || isDynamic)) {
return null;
}