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

- #14833

Closed
wants to merge 2 commits into from
Closed

- #14833

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/03-template-syntax/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To render a [snippet](snippet), use a `{@render ...}` tag.
The expression can be an identifier like `sum`, or an arbitrary JavaScript expression:

```svelte
{@render (cool ? coolSnippet : lameSnippet)()}
{@render (cool ? coolSnippet : boringSnippet)()}
```

## Optional snippets
Expand Down
10 changes: 5 additions & 5 deletions documentation/docs/03-template-syntax/18-class.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ If the value is an object, the truthy keys are added:
</script>

<!-- results in `class="cool"` if `cool` is truthy,
`class="lame"` otherwise -->
<div class={{ cool, lame: !cool }}>...</div>
`class="boring"` otherwise -->
<div class={{ cool, boring: !cool }}>...</div>
```

If the value is an array, the truthy values are combined:
Expand Down Expand Up @@ -77,14 +77,14 @@ Prior to Svelte 5.16, the `class:` directive was the most convenient way to set

```svelte
<!-- These are equivalent -->
<div class={{ cool, lame: !cool }}>...</div>
<div class:cool={cool} class:lame={!cool}>...</div>
<div class={{ cool, boring: !cool }}>...</div>
<div class:cool={cool} class:boring={!cool}>...</div>
```

As with other directives, we can use a shorthand when the name of the class coincides with the value:

```svelte
<div class:cool class:lame={!cool}>...</div>
<div class:cool class:boring={!cool}>...</div>
```

> [!NOTE] Unless you're using an older version of Svelte, consider avoiding `class:`, since the attribute is more powerful and composable.
2 changes: 1 addition & 1 deletion packages/svelte/src/compiler/legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ export function convert(source, ast) {
Text(node, { path }) {
const parent = path.at(-1);
if (parent?.type === 'RegularElement' && parent.name === 'style') {
// these text nodes are missing `raw` for some dumb reason
// these text nodes are missing `raw` for some reason
return /** @type {AST.Text} */ ({
type: 'Text',
start: node.start,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default test({

html: 'true',

skip: /^v4/.test(process.version), // node 4 apparently does some dumb stuff
skip: /^v4/.test(process.version), // node 4 apparently does some weird stuff

async test({ assert, component, target, window }) {
const event = new window.Event('click');
Expand Down
Loading