Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
hgiesel committed Jan 15, 2022
1 parent e4ff839 commit 7386a58
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions site/content/docs/02-template-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -1673,6 +1673,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 7386a58

Please sign in to comment.