do not escape html characters in tags in non-root <style> in SSR mode

pull/1159/merge
Conduitry 7 years ago
parent a33dfe5bf3
commit f606aee209

@ -10,5 +10,11 @@ export default function visitMustacheTag(
block.contextualise(node.expression);
const { snippet } = node.metadata;
generator.append('${__escape(' + snippet + ')}');
generator.append(
node.parent &&
node.parent.type === 'Element' &&
node.parent.name === 'style'
? '${' + snippet + '}'
: '${__escape(' + snippet + ')}'
);
}

@ -1,12 +1,13 @@
export default {
data: {
color: 'red',
foo: '/* < & > */',
},
html: `
<div>
<style>
/* something with < and > */
/* something with < and > */
div {
color: blue;
}
@ -27,7 +28,8 @@ export default {
<div>
<style>
/* something with < and > */
/* something with < and > */
/* < & > */
div {
color: red;
}
@ -38,6 +40,7 @@ export default {
<div>
<div>
<style>
/* < & > */
div > div {
color: red;
}

@ -1,6 +1,6 @@
<div>
<style>
/* something with < and > */
/* something with < and > */
div {
color: blue;
}
@ -21,7 +21,8 @@
<div>
<style>
/* something with < and > */
/* something with < and > */
{{foo}}
div {
color: {{color}};
}
@ -32,6 +33,7 @@
<div>
<div>
<style>
{{foo}}
div > div {
color: {{color}};
}

Loading…
Cancel
Save