Skip to content

Commit 6233afd

Browse files
Sync svelte docs (#1347)
sync svelte docs Co-authored-by: svelte-docs-bot[bot] <196124396+svelte-docs-bot[bot]@users.noreply.github.com>
1 parent 121d117 commit 6233afd

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

apps/svelte.dev/content/docs/svelte/03-template-syntax/01-basic-markup.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,14 @@ As with elements, `name={name}` can be replaced with the `{name}` shorthand.
8383
<Widget foo={bar} answer={42} text="hello" />
8484
```
8585

86+
## Spread attributes
87+
8688
_Spread attributes_ allow many attributes or properties to be passed to an element or component at once.
8789

88-
An element or component can have multiple spread attributes, interspersed with regular ones.
90+
An element or component can have multiple spread attributes, interspersed with regular ones. Order matters — if `things.a` exists it will take precedence over `a="b"`, while `c="d"` would take precedence over `things.c`:
8991

9092
```svelte
91-
<Widget {...things} />
93+
<Widget a="b" {...things} c="d" />
9294
```
9395

9496
## Events

apps/svelte.dev/content/docs/svelte/03-template-syntax/03-each.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ An each block can also specify an _index_, equivalent to the second argument in
4444
{#each expression as name, index (key)}...{/each}
4545
```
4646

47-
If a _key_ expression is provided — which must uniquely identify each list item — Svelte will use it to diff the list when data changes, rather than adding or removing items at the end. The key can be any object, but strings and numbers are recommended since they allow identity to persist when the objects themselves change.
47+
If a _key_ expression is provided — which must uniquely identify each list item — Svelte will use it to intelligently update the list when data changes by inserting, moving and deleting items, rather than adding or removing items at the end and updating the state in the middle.
48+
49+
The key can be any object, but strings and numbers are recommended since they allow identity to persist when the objects themselves change.
4850

4951
```svelte
5052
{#each items as item (item.id)}

apps/svelte.dev/content/docs/svelte/06-runtime/02-context.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ In many cases this is perfectly fine, but there is a risk: if you mutate the sta
126126
```svelte
127127
<!--- file: App.svelte ---->
128128
<script>
129-
import { myGlobalState } from 'svelte';
129+
import { myGlobalState } from './state.svelte.js';
130130
131131
let { data } = $props();
132132

apps/svelte.dev/content/docs/svelte/98-reference/21-svelte-compiler.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,10 +594,11 @@ namespace AST {
594594
| AST.SvelteBoundary;
595595
596596
export type Tag =
597-
| AST.ExpressionTag
598-
| AST.HtmlTag
597+
| AST.AttachTag
599598
| AST.ConstTag
600599
| AST.DebugTag
600+
| AST.ExpressionTag
601+
| AST.HtmlTag
601602
| AST.RenderTag;
602603
603604
export type TemplateNode =

0 commit comments

Comments
 (0)