Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: use svelte 5 syntax #13030

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion documentation/docs/20-core-concepts/10-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ By exporting `POST`/`PUT`/`PATCH`/`DELETE`/`OPTIONS`/`HEAD` handlers, `+server.j
<input type="number" bind:value={b}> =
{total}

<button on:click={add}>Calculate</button>
<button onclick={add}>Calculate</button>
```

```js
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/20-core-concepts/20-load.md
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ export async function load({ fetch, depends }) {
</script>

<p>random number: {data.number}</p>
<button on:click={rerunLoadFunction}>Update random number</button>
<button onclick={rerunLoadFunction}>Update random number</button>
```

### When do load functions rerun?
Expand Down
4 changes: 2 additions & 2 deletions documentation/docs/20-core-concepts/30-form-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ We can also implement progressive enhancement ourselves, without `use:enhance`,
}
</script>

<form method="POST" on:submit|preventDefault={handleSubmit}>
<form method="POST" onsubmit|preventDefault={handleSubmit}>
<!-- content -->
</form>
```
Expand Down Expand Up @@ -484,7 +484,7 @@ Form actions are the preferred way to send data to the server, since they can be
}
</script>

<button on:click={rerun}>Rerun CI</button>
<button onclick={rerun}>Rerun CI</button>
```

```js
Expand Down
4 changes: 2 additions & 2 deletions documentation/docs/30-advanced/67-shallow-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ For this to work, you need to load the data that the `+page.svelte` expects. A c
{#each data.thumbnails as thumbnail}
<a
href="/photos/{thumbnail.id}"
on:click={async (e) => {
onclick={async (e) => {
if (innerWidth < 640 // bail if the screen is too small
|| e.shiftKey // or the link is opened in a new window
|| e.metaKey || e.ctrlKey // or a new tab (mac: metaKey, win/linux: ctrlKey)
Expand Down Expand Up @@ -86,7 +86,7 @@ For this to work, you need to load the data that the `+page.svelte` expects. A c
{/each}

{#if $page.state.selected}
<Modal on:close={() => history.back()}>
<Modal onclose={() => history.back()}>
<!-- pass page data to the +page.svelte component,
just like SvelteKit would on navigation -->
<PhotoPage data={$page.state.selected} />
Expand Down
Loading