parser: disable template variables in `<style>` (#9777)
parent
ded3ce5863
commit
3c72c6abc2
|
@ -218,6 +218,10 @@ mut sb := strings.new_builder($lstartlength)\n
|
|||
// replace `$` to `\$` at first to escape JavaScript template literal syntax
|
||||
source.writeln(line.replace(r'$', r'\$').replace(r'$$', r'@').replace(r'.$',
|
||||
r'.@').replace(r"'", r"\'"))
|
||||
} else if state == .css {
|
||||
// disable template variable declaration in inline stylesheet
|
||||
// because of some CSS rules prefixed with `@`.
|
||||
source.writeln(line.replace(r'.$', r'.@').replace(r"'", r"\'"))
|
||||
} else {
|
||||
// HTML, may include `@var`
|
||||
// escaped by cgen, unless it's a `vweb.RawHtml` string
|
||||
|
|
|
@ -6,6 +6,11 @@
|
|||
h1 {
|
||||
color: green;
|
||||
}
|
||||
|
||||
@keyframes mymove {
|
||||
from {top: 0px;}
|
||||
to {top: 200px;}
|
||||
}
|
||||
</style>
|
||||
<style media="print">
|
||||
h1 {
|
||||
|
|
|
@ -6,6 +6,11 @@
|
|||
h1 {
|
||||
color: green;
|
||||
}
|
||||
|
||||
@keyframes mymove {
|
||||
from {top: 0px;}
|
||||
to {top: 200px;}
|
||||
}
|
||||
</style>
|
||||
<style media="print">
|
||||
h1 {
|
||||
|
|
Loading…
Reference in New Issue