-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Labels
Description
Describe the bug
I'm converting a Svelte custom element from v4 to v5 and needed a way to get the host element in my component code.
The custom elements doc page:
https://svelte.dev/docs/svelte/custom-elements
does not mention the $host() rune -- there is a link to it in the sidebar, but there is no mention of it on that page.
A short paragraph pointing to the rune would have saved me 30-40 minutes of trolling through stack overflow/github issues trying to find out the magic incantation.
Reproduction
-
Go to the custom elements page:
https://svelte.dev/docs/svelte/custom-elements -
Note that there is no reference to the
$host()rune -- which is only applicable in custom elements -- on that page.
Logs
System Info
System:
OS: macOS 15.6
CPU: (12) arm64 Apple M2 Pro
Memory: 124.95 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.18.0 - ~/.volta/tools/image/node/20.18.0/bin/node
Yarn: 1.22.22 - ~/.volta/tools/image/yarn/1.22.22/bin/yarn
npm: 10.8.2 - ~/.volta/tools/image/node/20.18.0/bin/npm
Browsers:
Chrome: 139.0.7258.129
Safari: 18.6
npmPackages:
svelte: ^5.0.0 => 5.34.7Severity
annoyance