Skip to content

Commit dfd1039

Browse files
author
Rich Harris
committed
tidy up
1 parent 3e9070e commit dfd1039

File tree

3 files changed

+24
-25
lines changed

3 files changed

+24
-25
lines changed

content/tutorial/03-advanced-svelte/05-bindings/02-each-block-bindings/README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ You can even bind to properties inside an `each` block.
77
```svelte
88
/// file: App.svelte
99
{#each todos as todo}
10-
<input
11-
type=checkbox
12-
bind:checked={todo.done}
13-
>
10+
<div class:done={todo.done}>
11+
<input
12+
type="checkbox"
13+
+++bind:+++checked={todo.done}
14+
/>
1415
15-
<input
16-
placeholder="What needs to be done?"
17-
bind:value={todo.text}
18-
>
16+
<input
17+
placeholder="What needs to be done?"
18+
+++bind:+++value={todo.text}
19+
/>
20+
</div>
1921
{/each}
2022
```
2123

content/tutorial/03-advanced-svelte/05-bindings/02-each-block-bindings/app-a/src/lib/App.svelte

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<script>
22
let todos = [
3-
{
4-
done: false,
5-
text: 'finish Svelte tutorial'
6-
},
3+
{ done: false, text: 'finish Svelte tutorial' },
74
{ done: false, text: 'build an app' },
85
{ done: false, text: 'world domination' }
96
];
@@ -19,16 +16,17 @@
1916
todos = todos.filter((t) => !t.done);
2017
}
2118
22-
$: remaining = todos.filter(
23-
(t) => !t.done
24-
).length;
19+
$: remaining = todos.filter((t) => !t.done).length;
2520
</script>
2621

2722
<h1>Todos</h1>
2823

2924
{#each todos as todo}
3025
<div class:done={todo.done}>
31-
<input type="checkbox" checked={todo.done} />
26+
<input
27+
type="checkbox"
28+
checked={todo.done}
29+
/>
3230

3331
<input
3432
placeholder="What needs to be done?"
@@ -39,7 +37,9 @@
3937

4038
<p>{remaining} remaining</p>
4139

42-
<button on:click={add}> Add new </button>
40+
<button on:click={add}>
41+
Add new
42+
</button>
4343

4444
<button on:click={clear}>
4545
Clear completed

content/tutorial/03-advanced-svelte/05-bindings/02-each-block-bindings/app-b/src/lib/App.svelte

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<script>
22
let todos = [
3-
{
4-
done: false,
5-
text: 'finish Svelte tutorial'
6-
},
3+
{ done: false, text: 'finish Svelte tutorial' },
74
{ done: false, text: 'build an app' },
85
{ done: false, text: 'world domination' }
96
];
@@ -19,9 +16,7 @@
1916
todos = todos.filter((t) => !t.done);
2017
}
2118
22-
$: remaining = todos.filter(
23-
(t) => !t.done
24-
).length;
19+
$: remaining = todos.filter((t) => !t.done).length;
2520
</script>
2621

2722
<h1>Todos</h1>
@@ -42,7 +37,9 @@
4237

4338
<p>{remaining} remaining</p>
4439

45-
<button on:click={add}> Add new </button>
40+
<button on:click={add}>
41+
Add new
42+
</button>
4643

4744
<button on:click={clear}>
4845
Clear completed

0 commit comments

Comments
 (0)