mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] compiler: escape backticks in attributes
Before this commit, the generated code crashed if an attribute in the template contained backticks. The compiler output something like ```js let block1 = createBlock(`<div foo="`bar`"/>`); ``` The backticks are now properly escaped.
This commit is contained in:
committed by
Sam Degueldre
parent
9c4c3e3b83
commit
c16d7d52b1
@@ -126,6 +126,20 @@ exports[`attributes dynamic attributes 1`] = `
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`attributes dynamic attributes with backticks 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div block-attribute-0=\\"foo\\"/>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
let attr1 = \`bar\`;
|
||||
return block1([attr1]);
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`attributes dynamic class attribute 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
@@ -374,6 +388,19 @@ exports[`attributes static attributes on void elements 1`] = `
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`attributes static attributes with backticks 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
let { text, createBlock, list, multi, html, toggler, comment } = bdom;
|
||||
|
||||
let block1 = createBlock(\`<div foo=\\"\\\\\`bar\\\\\`\\"/>\`);
|
||||
|
||||
return function template(ctx, node, key = \\"\\") {
|
||||
return block1();
|
||||
}
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`attributes static attributes with dashes 1`] = `
|
||||
"function anonymous(app, bdom, helpers
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user