Skip to content

Add ability to attach ElementInternals to Svelte Web Components #8472

Closed
@tronicboy1

Description

@tronicboy1

Describe the problem

Currently, there is no way to add a static tag to Svelte Web Components.

This poses a problem when you are trying to make custom elements with form interoperability using ElementInternals.

This could easily be fixed by adding logic in the constructor template to add the static value and internals setup logic.

https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals#examples

Describe the proposed solution

I propose adding a new setting to the <svelte:options /> tag; elementInternals="true".

We could then add the static field necessary and have a separate function for adding internals in the lifecycle hook.

Alternatives considered

I thought it would be possible to adjust the constructor of the element's class. This would not work as we cannot redefine custom elements.

Importance

i cannot use svelte without it

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