Skip to content

Commit

Permalink
chore: remove self-closing tags (#617)
Browse files Browse the repository at this point in the history
* remove self-closing tags in src

* self-closing tags
  • Loading branch information
Rich-Harris authored May 27, 2024
1 parent f56c35a commit dd92dc3
Show file tree
Hide file tree
Showing 60 changed files with 95 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<canvas
width={32}
height={32}
/>
></canvas>

<style>
canvas {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<canvas
width={32}
height={32}
/>
></canvas>

<style>
canvas {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<textarea
value={text}
on:keydown={handleKeydown}
/>
></textarea>

<style>
textarea {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<textarea
value={text}
on:keydown={handleKeydown}
/>
></textarea>

<style>
textarea {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const progress = writable(0);
</script>

<progress value={$progress} />
<progress value={$progress}></progress>

<button on:click={() => progress.set(0)}>
0%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
});
</script>

<progress value={$progress} />
<progress value={$progress}></progress>

<button on:click={() => progress.set(0)}>
0%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<span>{todo.description}</span>

<button on:click={() => store.remove(todo)} aria-label="Remove" />
<button on:click={() => store.remove(todo)} aria-label="Remove"></button>
</label>
</li>
{/each}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<span>{todo.description}</span>

<button on:click={() => store.remove(todo)} aria-label="Remove" />
<button on:click={() => store.remove(todo)} aria-label="Remove"></button>
</label>
</li>
{/each}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<span>{todo.description}</span>

<button on:click={() => store.remove(todo)} aria-label="Remove" />
<button on:click={() => store.remove(todo)} aria-label="Remove"></button>
</label>
</li>
{/each}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
on:click={() => {
selected = color;
}}
/>
></button>
{/each}
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@

previous = coords;
}}
/>
></canvas>

{#if previous}
<div
class="preview"
style="--color: {color}; --size: {size}px; --x: {previous.x}px; --y: {previous.y}px"
/>
></div>
{/if}

<style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
on:click={() => {
selected = color;
}}
/>
></button>
{/each}
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ Elements with a `contenteditable` attribute support `textContent` and `innerHTML

```svelte
/// file: App.svelte
<div +++bind:innerHTML={html}+++ contenteditable />
<div +++bind:innerHTML={html}+++ contenteditable></div>
```
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
let html = '<p>Write some text!</p>';
</script>

<div contenteditable />
<div contenteditable></div>

<pre>{html}</pre>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
let html = '<p>Write some text!</p>';
</script>

<div bind:innerHTML={html} contenteditable />
<div bind:innerHTML={html} contenteditable></div>

<pre>{html}</pre>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ First, add the `<audio>` element along with its bindings (we'll use the shorthan
bind:currentTime={time}
bind:duration
bind:paused
/>+++
></audio>+++
<button
class="play"
aria-label={paused ? 'play' : 'pause'}
/>
></button>
```

Next, add an event handler to the `<button>` that toggles `paused`:
Expand All @@ -30,7 +30,7 @@ Next, add an event handler to the `<button>` that toggles `paused`:
class="play"
aria-label={paused ? 'play' : 'pause'}
+++on:click={() => paused = !paused}+++
/>
></button>
```

Our audio player now has basic functionality. Let's add the ability to seek to a specific part of a track by dragging the slider. Inside the slider's `pointerdown` handler there's a `seek` function, where we can update `time`:
Expand Down Expand Up @@ -60,7 +60,7 @@ When the track ends, be kind — rewind:
+++ on:ended={() => {
time = 0;
}}+++
/>
></audio>
```

The complete set of bindings for `<audio>` and `<video>` is as follows — seven _readonly_ bindings...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<button
class="play"
aria-label={paused ? 'play' : 'pause'}
/>
></button>

<div class="info">
<div class="description">
Expand Down Expand Up @@ -57,7 +57,7 @@
});
}}
>
<div class="progress" style="--progress: {time / duration}%" />
<div class="progress" style="--progress: {time / duration}%"></div>
</div>
<span>{duration ? format(duration) : '--:--'}</span>
</div>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
on:ended={() => {
time = 0;
}}
/>
></audio>

<button
class="play"
aria-label={paused ? 'play' : 'pause'}
on:click={() => paused = !paused}
/>
></button>

<div class="info">
<div class="description">
Expand Down Expand Up @@ -69,7 +69,7 @@
});
}}
>
<div class="progress" style="--progress: {time / duration}%" />
<div class="progress" style="--progress: {time / duration}%"></div>
</div>
<span>{duration ? format(duration) : '--:--'}</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<canvas
width={32}
height={32}
/>
></canvas>

<style>
canvas {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
bind:this={canvas}
width={32}
height={32}
/>
></canvas>

<style>
canvas {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
on:click={() => {
selected = color;
}}
/>
></button>
{/each}
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@

previous = coords;
}}
/>
></canvas>

{#if previous}
<div
class="preview"
style="--color: {color}; --size: {size}px; --x: {previous.x}px; --y: {previous.y}px"
/>
></div>
{/if}

<style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
on:click={() => {
selected = color;
}}
/>
></button>
{/each}
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@

previous = coords;
}}
/>
></canvas>

{#if previous}
<div
class="preview"
style="--color: {color}; --size: {size}px; --x: {previous.x}px; --y: {previous.y}px"
/>
></div>
{/if}

<style>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="box" />
<div class="box"></div>

<style>
.box {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="box" />
<div class="box"></div>

<style>
.box {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Just like elements can have children...
```svelte
/// file: Card.svelte
<div class="card">
+++<slot />+++
+++<slot></slot>+++
</div>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ Inside `App.svelte`, we're rendering a `<Card>` component that contains `<span s
/// file: Card.svelte
<div class="card">
+++ <header>
<slot name="telephone" />
<slot name="company" />
<slot name="telephone"></slot>
<slot name="company"></slot>
</header>+++
<slot />
<slot></slot>
+++ <footer>
<slot name="address" />
<slot name="address"></slot>
</footer>+++
</div>
```
Expand Down Expand Up @@ -47,12 +47,12 @@ Alternatively, we could use the `:global` modifier inside `Card.svelte` to targe
```svelte
/// file: Card.svelte
<style>
/* ... */
/* ... */
+++.card :global(small) {
display: block;
font-size: 0.6em;
text-align: right;
}+++
</style>
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Open `FilterableList.svelte`. The `<slot>` is being rendered for each filtered i
/// file: FilterableList.svelte
<div class="content">
{#each data.filter(matches) as item}
<slot +++{item}+++ />
<slot +++{item}+++></slot>
{/each}
</div>
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
field="name"
>
<header slot="header" class="row">
<span class="color" />
<span class="color"></span>
<span class="name">name</span>
<span class="hex">hex</span>
<span class="rgb">rgb</span>
<span class="hsl">hsl</span>
</header>

<div class="row">
<span class="color" style="background-color: {row.hex}" />
<span class="color" style="background-color: {row.hex}"></span>
<span class="name">{row.name}</span>
<span class="hex">{row.hex}</span>
<span class="rgb">{row.rgb}</span>
Expand Down
Loading

0 comments on commit dd92dc3

Please sign in to comment.