-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Describe the bug
When serving html files through web_dev_server by using cargo tauri dev, any template element contents in the served HTML are removed.
While looking further into this issue, the culprit seem to be this:
| f = document.to_string().as_bytes().to_vec(); |
FMPOV, this should be changed to:
f = tauri_utils::html::serialize_node(&document);(I've actually tried this change out and it solves the issue)
A similar issue has already been fixed for the assets compilation process / asset csp modification, see #5247 (and also #4410) but the web_dev_server hasn't catched up with this change.
Reproduction
-
cargo create-tauri-app -
Select plain
vanillaHTML/CSS/JavaScript -
Add the following
templateelement before the closingbodytag insrc/index.html:
<template>
<tr>
<td>[ID]</td>
<td>[Name]</td>
<tr>
</template>cargo tauri dev- Inspect the DOM and observe that the
templateelement is empty
Expected behavior
HTML template element contents should be served properly.
For the example above, I would expect to see the following children when inspecting the DOM:
<template>
#document-fragment
<tr>
<td>[ID]</td>
<td>[Name]</td>
<tr>
</template>Platform and versions
Environment
› OS: Windows 10.0.19045 X64
› Webview2: 109.0.1518.69
› MSVC:
- Visual Studio Community 2022
- Visual Studio Community 2019
› Node.js: 19.1.0
› npm: 8.19.3
› pnpm: Not installed!
› yarn: Not installed!
› rustup: 1.25.1
› rustc: 1.66.1
› cargo: 1.66.1
› Rust toolchain: stable-x86_64-pc-windows-msvc
Packages
WARNING: no lock files found, defaulting to npm
› @tauri-apps/cli [NPM]: 1.2.3
› @tauri-apps/api [NPM]: Not installed!
› tauri [RUST]: 1.2.4,
› tauri-build [RUST]: 1.2.1,
› tao [RUST]: 0.15.8,
› wry [RUST]: 0.23.4,
App
› build-type: bundle
› CSP: default-src 'self'
› distDir: ../src
› devPath: ../src
package.json not found
App directory structure
├─ .vscode
├─ src
└─ src-tauri
Stack trace
No response
Additional context
No response