Skip to content

Inconsistent boolean element property processing #14366

@sserdyuk

Description

@sserdyuk

Describe the bug

I noticed that Svelte changes my html slightly during rendering when boolean HTML attributes are in use.

Here's a two lines of HTML from a svelte file:

<form action="#" novalidate></form>
<custom-element popover></custom-element>

Here's how it's rendered:

<form action="#" novalidate></form> 
<custom-element popover=""></custom-element>

Note how the popover attribute was unexpectedly altered into a string while novalidate was not.

Reproduction

Drop these lines into any *.svelte file and observe the rendered source.

<form action="#" novalidate></form>
<custom-element popover></custom-element>

Logs

System Info

System:
    OS: Linux 6.8 Linux Mint 22 (Wilma)
    CPU: (16) x64 AMD Ryzen 7 5700G with Radeon Graphics
    Memory: 16.49 GB / 30.72 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 20.19.4 - ~/.bin/node/bin/node
    npm: 10.8.2 - ~/.bin/node/bin/npm
  Browsers:
    Chrome: 139.0.7258.154
  npmPackages:
    @sveltejs/adapter-auto: ^6.0.0 => 6.1.0 
    @sveltejs/kit: ^2.22.0 => 2.37.0 
    @sveltejs/vite-plugin-svelte: ^6.0.0 => 6.1.3 
    svelte: ^5.0.0 => 5.38.6 
    vite: ^7.0.4 => 7.1.4

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions