render.rs
render.rs copied to clipboard
Script tag portals body data when empty
Not sure whats going on here but checkout this layout function.
pub fn layout() -> content::Html<String> {
content::Html(html!(
<>
<HTML5Doctype />
<html lang={"en"}>
<head>
<title>{"Test"}</title>
<link href={"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"} rel={"stylesheet"}></link>
<script src={"/assets/main.js"}></script>
</head>
<body>
<Header />
<Nav title={"My title"} body={"Once you have their money, you never give it back."} />
<div>{"Title"}</div>
</body>
</html>
</>
))
}
When I use the above, the entire body content gets rendered inside of the
<script src={"/assets/main.js"}>{""}</script>
I'm assuming that it's not closing out empty tags.
I think I'm seeing the same behaviour with
I'm seeing this with both script and textarea; inserting an empty string does workaround it
If I understand this correctly, only void elements are allowed to be self-closing in HTML, and even then it doesn't actually do anything