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); block.contextualise(node.expression);
const { snippet } = node.metadata; 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 { export default {
data: { data: {
color: 'red', color: 'red',
foo: '/* < & > */',
}, },
html: ` html: `
<div> <div>
<style> <style>
/* something with < and > */ /* something with < and > */
div { div {
color: blue; color: blue;
} }
@ -27,7 +28,8 @@ export default {
<div> <div>
<style> <style>
/* something with < and > */ /* something with < and > */
/* < & > */
div { div {
color: red; color: red;
} }
@ -38,6 +40,7 @@ export default {
<div> <div>
<div> <div>
<style> <style>
/* < & > */
div > div { div > div {
color: red; color: red;
} }

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

Loading…
Cancel
Save