Skip to content

Commit bd0403e

Browse files
committed
moved the rune reference further up
1 parent a7abf8d commit bd0403e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

documentation/docs/07-misc/04-custom-elements.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Custom elements
44

55
<!-- - [basically what we have today](https://svelte.dev/docs/custom-elements-api) -->
66

7-
Svelte components can also be compiled to custom elements (aka web components) using the `customElement: true` compiler option. You should specify a tag name for the component using the `<svelte:options>` [element](svelte-options).
7+
Svelte components can also be compiled to custom elements (aka web components) using the `customElement: true` compiler option. You should specify a tag name for the component using the `<svelte:options>` [element](svelte-options). Within the custom element you can also access the host element and do things such as dispatching events using the [\$host](https://svelte.dev/docs/svelte/$host) rune.
88

99
```svelte
1010
<svelte:options customElement="my-element" />
@@ -128,4 +128,3 @@ Custom elements can be a useful way to package components for consumption in a n
128128
- Polyfills are required to support older browsers
129129
- You can use Svelte's context feature between regular Svelte components within a custom element, but you can't use them across custom elements. In other words, you can't use `setContext` on a parent custom element and read that with `getContext` in a child custom element.
130130
- Don't declare properties or attributes starting with `on`, as their usage will be interpreted as an event listener. In other words, Svelte treats `<custom-element oneworld={true}></custom-element>` as `customElement.addEventListener('eworld', true)` (and not as `customElement.oneworld = true`)
131-
- If you would like to dispatch custom events or just access the host element then you can use the [\$host](https://svelte.dev/docs/svelte/$host) rune.

0 commit comments

Comments
 (0)