Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sveltekit build not rendering HTML properly #12252

Open
mellunar opened this issue May 22, 2024 · 2 comments
Open

Sveltekit build not rendering HTML properly #12252

mellunar opened this issue May 22, 2024 · 2 comments

Comments

@mellunar
Copy link

Describe the bug

When building the code to production, Sveltekit is not rendering the code as it's supposed to be.

This is how my code looks like in editor:
sveltekit1

When previewing it with 'npm run dev', it renders the code properly:
sveltekit2

But after building it to production, this is how it's rendered into view:
sveltekit3

In the last picture, the div is outside the anchor tag, causing the layout to be broken, and another anchor tag is created inside it.

Reproduction

Create a project, add an anchor tag on a page, then insert content into a div inside it, and build/preview the project.

Logs

No response

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
    Memory: 21.48 GB / 31.93 GB
  Binaries:
    Node: 20.13.0 - ~\.nvm\versions\node\v20.13.0\bin\node.EXE   
    npm: 10.5.2 - ~\.nvm\versions\node\v20.13.0\bin\npm.CMD      
  npmPackages:
    @sveltejs/adapter-auto: ^3.2.0 => 3.2.0
    @sveltejs/kit: ^2.5.9 => 2.5.9
    @sveltejs/vite-plugin-svelte: ^3.1.0 => 3.1.0
    svelte: ^4.2.17 => 4.2.17
    vite: ^5.2.11 => 5.2.11

Severity

annoyance

Additional Information

No response

@eltigerchino
Copy link
Member

Please provide a minimal reproduction in the form of a downloadable repository. Otherwise, I’m inclined to think this is an issue with how browsers handle anchor tags nested in other anchor tags. A similar issue to this is withastro/astro#4864

@brunnerh
Copy link
Member

brunnerh commented May 23, 2024

It is not a browser issues, this is just invalid according to the spec.

Content model:
Transparent, but there must be no interactive content descendant, a element descendant, or descendant with the tabindex attribute specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants