You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/svelte/tests/README.md
-11Lines changed: 0 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -13,24 +13,13 @@ This repo tries to migrate as many tests from the currente Svelte project over t
13
13
## Breaking changes
14
14
15
15
- Order of list insertions has changed: It's now back to front because that's faster
16
-
- Directives are not applied in order for all directives anymore, see `apply-directives-in-order-2` for an example
17
16
- Slight timing differences mean that things may fire less in some cases (behavior should be unaffected though) - see `component-binding-each-remount-unkeyed` for an example
18
17
- It's currently possible to create infinite loops with `$:` invoking each other
19
18
- Fallback value is now set on all `undefined` values, not just on the first one
20
-
- whitespace handling is now different: surrounding space is always trimmed, space within on text nodes is kept as-is, unless whitespace only, in which case it's trimmed to one whitespace
21
-
- assignment to `@const` destructured parts is no longer allowed (see change to `const-tag-each-destructure-computed-props` / `const-tag-each-destructure-computed-in-computed`). This was an oversight that this was ever allowed
22
-
- the CSS hash no longer comes last (can be first or inbetween) (not really breaking, unless you have very very weird css selectors https://stackoverflow.com/questions/15670631/does-the-order-of-classes-listed-on-an-item-affect-the-css)
23
-
- The `css` compiler option no longer exists. CSS will always be outputted, and will never be inlined into the JS
24
19
- CSS is no longer minified. Unused styles are instead commented out
25
20
-`:global(...)` compound selectors (e.g. `.foo:global(.bar)` or `:global(.foo).bar`) are no longer permitted. These are nonsensical and don't do anything useful in Svelte 4 — better to just get rid of them
26
-
-`beforeUpdate` no longer runs twice on initial render if it modifies a variable referenced in the template
27
21
- transitions: when one element fades out and a new one (which is on the same element but another instance of it) fades in at the same time, the new one is now below the old one (was above before)
28
22
- transitions: now wait one tick before they start playing to align with web animations API
29
-
-`bind:clientWidth/clientHeight/offsetWidth/offsetHeight` now use mutation observers intead of iframes to measure stuff
30
-
- APIs for instantiating/rendering components have changed. Instead of `new App(...)`, it's `mount(App)`, and instead of `App.render(...)` it's `render(App)`
31
-
- unlike `App.render(...)`, `render(App, ...)` does not emit CSS
32
-
- If you have a `contenteditable` node with a corresponding binding _and_ a reactive value inside it (example: `<div contenteditable=true bind:textContent>count is {count}</div>`) then the value inside the contenteditable will not be updated by updates to `count` because the binding takes full control over the content immediately and it should only be updated through it.
33
-
-`legacy` option to generate IE10/11 compatible code was removed
`render` also no longer returns CSS; it should be served separately from a CSS file.
34
+
35
+
## Whitespace handling changed
36
+
37
+
Previously, Svelte employed a very complicated algorithm to determine if whitespace should be kept or not. Svelte 5 simplifies this which makes it easier to reason about as a developer. The rules are:
38
+
39
+
- Whitespace between nodes is collapsed to one whitespace
40
+
- Whitespace at the start and end of a tag is removed completely
41
+
- Certain exceptions apply such as keeping whitespace inside `pre` tags
42
+
43
+
As before, you can disable whitespace trimming by setting the `preserveWhitespace` option in your compiler settings or on a per-component basis in `<svelte:options>`.
44
+
45
+
## More recent browser required
46
+
47
+
Svelte now use Mutation Observers intead of IFrames to measure dimensions for `bind:clientWidth/clientHeight/offsetWidth/offsetHeight`. It also no longer listens to the `change` event on range inputs. Lastly, the `legacy` option was removed (or rather, replaced with a different set of settings).
48
+
49
+
## Changes to compiler options
50
+
51
+
- The `false`/`true` (already deprecated previously) and the `"none"` values were removed as valid values from the `css` option
52
+
- The `legacy` option was repurposed
53
+
- The `hydratable` option has been removed. Svelte components are always hydratable now
54
+
- The `tag` option was removed. Use `<svelte:options customElement="tag-name" />` inside the component instead
55
+
- The `loopGuardTimeout`, `format`, `sveltePath`, `errorMode` and `varsReport` options were removed
56
+
57
+
## Other breaking changes
58
+
59
+
### Stricter `@const` assignment validation
60
+
61
+
Assignments to destructured parts of a `@const` declaration are no longer allowed. It was an oversight that this was ever allowed.
62
+
63
+
### CSS hash position no longer deterministic
64
+
65
+
Previously Svelte would always insert the CSS hash last. This is no longer guaranteed in Svelte 5. This is only breaking if you [have very weird css selectors](https://stackoverflow.com/questions/15670631/does-the-order-of-classes-listed-on-an-item-affect-the-css).
66
+
67
+
### beforeUpdate change
68
+
69
+
`beforeUpdate` no longer runs twice on initial render if it modifies a variable referenced in the template.
70
+
71
+
### `contenteditable` behavior change
72
+
73
+
If you have a `contenteditable` node with a corresponding binding _and_ a reactive value inside it (example: `<div contenteditable=true bind:textContent>count is {count}</div>`), then the value inside the contenteditable will not be updated by updates to `count` because the binding takes full control over the content immediately and it should only be updated through it.
0 commit comments