You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Svelte tries its best to infer the correct namespace from the element's surroundings, but it's not always possible. You can make it explicit with an `xmlns` attribute:
@@ -73,7 +72,7 @@ Svelte tries its best to infer the correct namespace from the element's surround
73
72
## `<svelte:window>`
74
73
75
74
```svelte
76
-
<svelte:window on:event={handler} />
75
+
<svelte:window onevent={handler} />
77
76
```
78
77
79
78
```svelte
@@ -86,13 +85,12 @@ Unlike `<svelte:self>`, this element may only appear at the top level of your co
86
85
87
86
```svelte
88
87
<script>
89
-
/** @param {KeyboardEvent} event */
90
88
function handleKeydown(event) {
91
89
alert(`pressed the ${event.key} key`);
92
90
}
93
91
</script>
94
92
95
-
<svelte:window on:keydown={handleKeydown} />
93
+
<svelte:window onkeydown={handleKeydown} />
96
94
```
97
95
98
96
You can also bind to the following properties:
@@ -117,7 +115,7 @@ All except `scrollX` and `scrollY` are readonly.
117
115
## `<svelte:document>`
118
116
119
117
```svelte
120
-
<svelte:document on:event={handler} />
118
+
<svelte:document onevent={handler} />
121
119
```
122
120
123
121
```svelte
@@ -129,7 +127,7 @@ Similarly to `<svelte:window>`, this element allows you to add listeners to even
129
127
As with `<svelte:window>`, this element may only appear the top level of your component and must never be inside a block or element.
Similarly to `<svelte:window>`, this element allows you to add listeners to events on `document.body`, such as `mouseenter` and `mouseleave`, which don't fire on `window`. It also lets you use [actions](/docs/element-directives#use-action) on the `<body>` element.
151
149
152
150
As with `<svelte:window>` and `<svelte:document>`, this element may only appear the top level of your component and must never be inside a block or element.
0 commit comments