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

Svelte 5: Undocumented breaking changes #11400

Open
2 tasks done
Conduitry opened this issue Apr 30, 2024 · 14 comments
Open
2 tasks done

Svelte 5: Undocumented breaking changes #11400

Conduitry opened this issue Apr 30, 2024 · 14 comments
Milestone

Comments

@Conduitry
Copy link
Member

Conduitry commented Apr 30, 2024

Describe the bug

There are a number of breaking changes that have not made their way into the official list of breaking changes yet. I'm creating this issue to track them. Maintainers: Edit this post as we come across new ones, and check them off as we have PRs documenting them.

Reproduction

https://svelte-5-preview.vercel.app/docs/breaking-changes

Logs

No response

System Info

-

Severity

annoyance

@Conduitry Conduitry added this to the 5.0 milestone Apr 30, 2024
@Conduitry Conduitry pinned this issue Apr 30, 2024
@Conduitry Conduitry changed the title Undocumented Svelte 5 breaking changes Svelte 5: Undocumented breaking changes Apr 30, 2024
@GauBen

This comment was marked as resolved.

@frederikhors
Copy link

@Conduitry I would add what I mentioned here: #11431.

@Conduitry
Copy link
Member Author

Changes that only occur in runes mode are not the sort of changes we're concerned with here. Breaking changes are instances where a user upgrades from Svelte 4 to Svelte 5 and their existing component starts to behave differently.

@paoloricciuti

This comment was marked as resolved.

@Conduitry
Copy link
Member Author

Again, no, not for the purposes of documenting what the breaking changes are for people who try to use their components as-is when upgrading from Svelte 4 to Svelte 5.

@frederikhors

This comment was marked as off-topic.

@rootext

This comment was marked as resolved.

@theetrain

This comment was marked as resolved.

@FoHoOV

This comment was marked as resolved.

@7nik

This comment was marked as resolved.

dummdidumm added a commit that referenced this issue May 15, 2024
Rich-Harris added a commit that referenced this issue May 15, 2024
* docs: document more breaking changes

Related to #11400
closes #11590

* Update sites/svelte-5-preview/src/routes/docs/content/03-appendix/02-breaking-changes.md

Co-authored-by: Rich Harris <rich.harris@vercel.com>

* Update sites/svelte-5-preview/src/routes/docs/content/03-appendix/02-breaking-changes.md

Co-authored-by: Rich Harris <rich.harris@vercel.com>

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
@Serator
Copy link

Serator commented May 18, 2024

https://svelte.dev/docs/element-directives#bind-property

image

Order doesn't matter now, which is a good thing!

  • Svelte 5 (runes) - if a field is changed once, we will see the new value in the console
  • Svelte 5 (no runes) - if a field is changed once, we will see the old value in the console

@theetrain
Copy link
Contributor

A follow up to #11400 (comment):

I see that :where is only applied to Nested CSS, and not all scoped CSS. Current documentation reads (emphasis mine):

To avoid issues caused by unpredictable specificity changes, scoped CSS selectors now use :where(.svelte-xyz123) selector modifiers alongside .svelte-xyz123 (where xyz123 is, as previously, a hash of the <style> contents). You can read more detail here.

And the linked PR's phrasing strongly implies :where() is applied everywhere. Should the documentation be rephrased to account for this?

Right now this:

<style>
  button {
    color: red;
  }
  button {
    & span {
      color: green;
    }
  }
</style>

compiles to this:

button.svelte-1ya7ade {
  color: red;
}
button.svelte-1ya7ade {
  & span:where(.svelte-1ya7ade) {
    color: green;
  }
}

Demo.

@dummdidumm
Copy link
Member

I don't fully understand what you're asking for. Could you give an example about how you want to rephrase this?

@theetrain
Copy link
Contributor

Perhaps like this:

-To avoid issues caused by unpredictable specificity changes, scoped CSS selectors
+To avoid issues caused by unpredictable specificity changes, nested CSS selectors
now use `:where(.svelte-xyz123)` selector modifiers alongside `.svelte-xyz123`
(where `xyz123` is, as previously, a hash of the `<style>` contents).
+Top-level selectors will continue to be scoped without the use of `:where()`.

Key difference is nested versus only scoped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants