Skip to content

Conversation

dummdidumm
Copy link
Member

@dummdidumm dummdidumm commented Dec 2, 2024

  • polyfills for at and withResolvers
  • avoid using structuredClone, we can use JSON.parse(JSON.stringify(..)) instead at that position

makes the site work in more browsers

closes #911 assuming we're fine with not supporting Safari 13 and lower (or similarly old browsers; i.e. earlier than ~2020)

Copy link

vercel bot commented Dec 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
svelte-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 3, 2024 8:43am

@Rich-Harris
Copy link
Member

I don't want to touch core-js with a bargepole. This is the effect of those two imports on the bundle size:

  • before: 184.60 kB / 105.31 kB transferred
  • after: 208.06 kB / 118.35 kB transferred

Let's find another approach, whether that's writing our own polyfill or avoiding those features

- polyfills for `at` and `withResolvers`
- avoid using `structuredClone`, we can use `JSON.parse(JSON.stringify(..))` instead at that position

makes the site work in more browsers

closes #911
@dummdidumm
Copy link
Member Author

wow, that's bad - I created our own polyfills instead

@Rich-Harris Rich-Harris merged commit 0d2d24f into main Dec 3, 2024
5 checks passed
@Rich-Harris Rich-Harris deleted the polyfills branch December 3, 2024 16:53
@kevinrenskers
Copy link

Can you let me know when this is deployed to the site, so that I can test it for you?

@Rich-Harris
Copy link
Member

It's deployed already

@kevinrenskers
Copy link

It's definitely still broken.

Safari 14:

Screenshot 2024-12-03 at 18 55 10

Safari 15 / 16 / 17:

Screenshot 2024-12-03 at 18 56 10

@Rich-Harris
Copy link
Member

Well that's odd. I only have 17.6 installed here but it works fine. Both places that use Promise.withResolvers are polyfilled. Any chance there's some fucked up caching going on?

@kevinrenskers
Copy link

Promise.withResolvers was added in Safari 17.4, so it makes sense that it works for you in 17.6.

I did a hard refresh, so I don't know? CloudFlare maybe?

@simonljus
Copy link

The Polyfill for Array.prototype.at does not handle NaN and floating point numbers the same way as specified in the MDN docs.

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

Successfully merging this pull request may close these issues.

Svelte Playground doesn't work in Safari 17 or lower
4 participants