inject css with template string to allow for line breaks (#894)

* inject css with template string to allow for line breaks

alternative solution would to be implement a struct `JsStringLiteral`
with `fmt::Display` that escapes all forbidden codepoints from the spec
https://www.ecma-international.org/ecma-262/#sec-literals-string-literals

template string literal seems fine as all browsers that tauri supports have
had support for them for the past 3-4+ years

Signed-off-by: Chip Reed <chip@chip.sh>

* chore(changes) adjust change file

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
chip 2020-07-25 11:52:52 -07:00 committed by GitHub
parent 6ee720eae1
commit b96b1fb6b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -2,4 +2,4 @@
"tauri": patch
---
make sure css content injected is inside a string and not injected raw
Make sure CSS content loaded with the `loadAsset` API is inside a template string and not injected raw.

View File

@ -73,7 +73,7 @@ pub fn load(
else
css.appendChild(document.createTextNode(content))
document.getElementsByTagName("head")[0].appendChild(css);
}})("{css}")
}})(`{css}`)
"#,
css = asset_str
));