mirror of
https://github.com/tauri-apps/tauri.git
synced 2025-01-04 17:18:56 +03:00
fix(tauri) ensure css content is loaded inside a string (#884)
Signed-off-by: Chip Reed <chip@chip.sh>
This commit is contained in:
parent
91f1c88009
commit
e3e2e39208
5
.changes/load-asset-css.md
Normal file
5
.changes/load-asset-css.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri": patch
|
||||
---
|
||||
|
||||
make sure css content injected is inside a string and not injected raw
|
@ -65,15 +65,15 @@ pub fn load(
|
||||
if asset_type == "stylesheet" {
|
||||
webview_ref.eval(&format!(
|
||||
r#"
|
||||
(function () {{
|
||||
(function (content) {{
|
||||
var css = document.createElement('style')
|
||||
css.type = 'text/css'
|
||||
if (css.styleSheet)
|
||||
css.styleSheet.cssText = {css}
|
||||
else
|
||||
css.appendChild(document.createTextNode({css}))
|
||||
if (css.styleSheet)
|
||||
css.styleSheet.cssText = content
|
||||
else
|
||||
css.appendChild(document.createTextNode(content))
|
||||
document.getElementsByTagName("head")[0].appendChild(css);
|
||||
}})()
|
||||
}})("{css}")
|
||||
"#,
|
||||
css = asset_str
|
||||
));
|
||||
|
Loading…
Reference in New Issue
Block a user