Skip to content

Commit 7f3fa47

Browse files
author
Rich Harris
committed
tighten up
1 parent 2494208 commit 7f3fa47

File tree

4 files changed

+18
-55
lines changed

4 files changed

+18
-55
lines changed

content/tutorial/01-svelte/06-bindings/01-text-inputs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Instead, we can use the `bind:value` directive:
1010

1111
```svelte
1212
/// file: App.svelte
13-
<input bind:value={name}>
13+
<input +++bind:+++value={name}>
1414
```
1515

1616
This means that not only will changes to the value of `name` update the input value, but changes to the input value will update `name`.

content/tutorial/01-svelte/06-bindings/02-numeric-inputs/README.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ With `bind:value`, Svelte takes care of it for you:
88

99
```svelte
1010
/// file: App.svelte
11-
<input type=number bind:value={a} min=0 max=10>
12-
<input type=range bind:value={a} min=0 max=10>
11+
<label>
12+
<input type="number" +++bind:+++value={a} min="0" max="10" />
13+
<input type="range" +++bind:+++value={a} min="0" max="10" />
14+
</label>
15+
16+
<label>
17+
<input type="number" +++bind:+++value={b} min="0" max="10" />
18+
<input type="range" +++bind:+++value={b} min="0" max="10" />
19+
</label>
1320
```

content/tutorial/01-svelte/06-bindings/02-numeric-inputs/app-a/src/lib/App.svelte

+4-26
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,13 @@
44
</script>
55

66
<label>
7-
<input
8-
type="number"
9-
value={a}
10-
min="0"
11-
max="10"
12-
/>
13-
14-
<input
15-
type="range"
16-
value={a}
17-
min="0"
18-
max="10"
19-
/>
7+
<input type="number" value={a} min="0" max="10" />
8+
<input type="range" value={a} min="0" max="10" />
209
</label>
2110

2211
<label>
23-
<input
24-
type="number"
25-
value={b}
26-
min="0"
27-
max="10"
28-
/>
29-
30-
<input
31-
type="range"
32-
value={b}
33-
min="0"
34-
max="10"
35-
/>
12+
<input type="number" value={b} min="0" max="10" />
13+
<input type="range" value={b} min="0" max="10" />
3614
</label>
3715

3816
<p>{a} + {b} = {a + b}</p>

content/tutorial/01-svelte/06-bindings/02-numeric-inputs/app-b/src/lib/App.svelte

+4-26
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,13 @@
44
</script>
55

66
<label>
7-
<input
8-
type="number"
9-
bind:value={a}
10-
min="0"
11-
max="10"
12-
/>
13-
14-
<input
15-
type="range"
16-
bind:value={a}
17-
min="0"
18-
max="10"
19-
/>
7+
<input type="number" bind:value={a} min="0" max="10" />
8+
<input type="range" bind:value={a} min="0" max="10" />
209
</label>
2110

2211
<label>
23-
<input
24-
type="number"
25-
bind:value={b}
26-
min="0"
27-
max="10"
28-
/>
29-
30-
<input
31-
type="range"
32-
bind:value={b}
33-
min="0"
34-
max="10"
35-
/>
12+
<input type="number" bind:value={b} min="0" max="10" />
13+
<input type="range" bind:value={b} min="0" max="10" />
3614
</label>
3715

3816
<p>{a} + {b} = {a + b}</p>

0 commit comments

Comments
 (0)