Skip to content

Svelte 5: $host() rune for custom elements #11022

Closed
@Rich-Harris

Description

@Rich-Harris

Describe the problem

Previously: #3091

The current workaround for getting hold of the host element, when compiling as a custom element, is convoluted and weird.

Describe the proposed solution

It would be useful to have a $host() rune, which would be a compile error without the relevant option.

With this, we could treat createEventDispatcher as deprecated — IIRC the only real reason it isn't already is that we need it to dispatch events from custom elements.

Importance

nice to have

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions