Skip to content

Custom element boolean attribute incorrectly converted to true #10871

Open
@CLDXiang

Description

@CLDXiang

Describe the bug

When passing a boolean attribute to a custom element, the prop value is alway true.

Reproduction

https://github.com/CLDXiang/svelte-custom-elements-attribute-bug

pnpm install
pnpm dev

In demo/App.svelte:

<my-component a-boolean={false} />

But the rendered aBoolean value is true.

Logs

No response

System Info

System:
    OS: macOS 13.6.1
    CPU: (20) x64 Intel(R) Core(TM) i9-10910 CPU @ 3.60GHz
    Memory: 133.66 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.20.1 - ~/.nvm/versions/node/v16.20.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.20.1/bin/yarn
    npm: 8.19.4 - ~/.nvm/versions/node/v16.20.1/bin/npm
  Browsers:
    Chrome: 123.0.6312.59
    Firefox: 100.0.2
    Safari: 16.6
  npmPackages:
    svelte: ^4.2.12 => 4.2.12

Severity

annoyance

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