From cea622af8bf5362a21c39bd7ea3e0728bd5c1d6b Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Wed, 18 Dec 2024 18:45:31 +0100 Subject: [PATCH] better docs --- .../docs/05-special-elements/04-svelte-html.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/documentation/docs/05-special-elements/04-svelte-html.md b/documentation/docs/05-special-elements/04-svelte-html.md index 86e76f2a77..9708a9f0ec 100644 --- a/documentation/docs/05-special-elements/04-svelte-html.md +++ b/documentation/docs/05-special-elements/04-svelte-html.md @@ -6,6 +6,17 @@ title: ``` -Similarly to ``, this element allows you to add properties and listeners to events on `document.documentElement`. This is useful for attributes such as `lang` which influence how the browser interprets the content. +This element allows you to add attributes and event listeners to the `` root (i.e. `document.documentElement`). This is useful for attributes such as `lang` which influence how the browser interprets the content. -As with ``, `` and ``, this element may only appear the top level of your component and must never be inside a block or element. +```svelte + + + + +``` + +> [!NOTE] If you use SvelteKit version 2.13 or higher (and have `%svelte.htmlAttributes%` on the `` tag in `app.html`), the attributes will automatically be server rendered and hydrated correctly. If you're using a custom server rendering setup, you can retrieve the server-rendered attributes string via `htmlAttributes` from the `render` method response and inject it into your HTML manually. + +This element may only appear the top level of your component and must never be inside a block or element.