-
Notifications
You must be signed in to change notification settings - Fork 99
🐛 BUG: <html> tag is removed when there are element elements or components before it #913
Copy link
Copy link
Open
Labels
- P2: has workaroundBug, but has workaround (priority)Bug, but has workaround (priority)
Description
What version of @astrojs/compiler are you using?
2.3.4
What package manager are you using?
pnpm
What operating system are you using?
Linux
Describe the Bug
When using any element or component before the html tag (or body tag), the html and body tags are removed from the output
Source
<hr /><html lang="en"><body><h1>Astro</h1></body></html>Current result
$$render`${$$maybeRenderHead($$result)}<hr><h1>Astro</h1>`;Expected result
$$render`<html lang="en">${$$maybeRenderHead($$result)}<body><hr><h1>Astro</h1></body></html>`This is how other HTML5 compliant parsers like parse5 handle the source code.
In the stackblitz repro you will see that the elements are somewhat rearranged, but that's the browser's work. See a direct visualization of the issue here
A workaround would be to simply NOT do that 😅
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-sb9voo?file=src%2Fpages%2Findex.astro
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
- P2: has workaroundBug, but has workaround (priority)Bug, but has workaround (priority)