Skip to content

MWC attribute without value is discarded in Svelte #5951

@duongdominhchau

Description

@duongdominhchau

Description

When I use Material Web Components with Svelte, attributes without value are discarded and thus result in incorrectly styled element. I guess because they are unknown attributes so the default value for them is undefined and thus were removed under the rule "no nullish". Is there a way to keep these attributes as-is, or I have to wrap them inside Svelte component and export the boolean properties corresponding to these attributes?

How to reproduce

npx degit sveltejs/template example-project
cd example-project
npm i
npm add svelte@latest
npm add @material/mwc-button

Change the content of App.svelte to

<script>
  import '@material/mwc-button';
</script>

<main>
  <mwc-button raised label="Hello"/>
  <mwc-button raised=y label="Hello"/>
</main>

then run with

npm run dev

Other information

  • Svelte version: 3.32.1
  • I use Rollup (from the project template)

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