0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-25 17:19:22 +01:00
svelte/documentation/docs/05-special-elements/02-svelte-document.md
Rich Harris 4f6bb41030
More docs stuff (#13769)
* fix

* link

* more docs stuff

* more

* more

* fix

* more

* more

* fix

* fix

* more

* ffs

* FML
2024-10-22 02:11:35 -04:00

726 B

title
<svelte:document>
<svelte:document onevent={handler} />
<svelte:document bind:prop={value} />

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 on document.

As with <svelte:window>, this element may only appear the top level of your component and must never be inside a block or element.

<svelte:document onvisibilitychange={handleVisibilityChange} use:someAction />

You can also bind to the following properties:

  • activeElement
  • fullscreenElement
  • pointerLockElement
  • visibilityState

All are readonly.