Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
hgiesel committed May 6, 2022
1 parent a49153b commit 5192cbf
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions site/content/docs/02-template-syntax.md
Expand Up @@ -1697,6 +1697,25 @@ All except `scrollX` and `scrollY` are readonly.

> Note that the page will not be scrolled to the initial value to avoid accessibility issues. Only subsequent changes to the bound variable of `scrollX` and `scrollY` will cause scrolling. However, if the scrolling behaviour is desired, call `scrollTo()` in `onMount()`.
### `<svelte:document>`

```sv
<svelte:document on:event={handler}/>
```

---

Similarly to `<svelte:window>`, this element allows you to add listeners to events on `document`, such as `visibilitychange`, which don't fire on `window`. It also lets you use [actions](/docs#template-syntax-element-directives-use-action) on `document`.

`<svelte:document>` also has to appear at the top level of your component.

```sv
<svelte:document
on:visibilitychange={handleVisibilityChange}
use:someAction
/>
```

### `<svelte:body>`

```sv
Expand Down

0 comments on commit 5192cbf

Please sign in to comment.