Skip to content

Polyfill Array.prototype.at mainly for Safari < 15.4 - #1339

Merged
microbit-matt-hillsdon merged 2 commits into
mainfrom
polyfill-array-at
Sep 17, 2026
Merged

microbit-matt-hillsdon merged 2 commits into
mainfrom
polyfill-array-at

Conversation

@microbit-matt-hillsdon

Copy link
Copy Markdown
Collaborator

marked 18 calls .at while parsing, which is ES2022 and so needs Chrome 92, Safari 15.4 or Firefox 90. Our floor is chrome90/firefox88/safari14.1/ios14.5 (BUILD_TARGETS in vite.config.ts, mirrored in browserslist), and esbuild lowers syntax but never built-ins, so Safari and iOS 14.1-15.3 users get a TypeError from the lexer. The error boundary catches it, so the whole docs panel is replaced by the error page rather than the markdown degrading.

Reported once from the wild against v3.1.13
(PYTHON-EDITOR-NEXT-3V7) from a browser below the floor, but the same call fails on Safari versions we do claim to support.

tsconfig's ES2021 lib already stops our own source calling .at; this is only needed because the call is in a dependency.

Prime candidate for removing on next floor bump.

marked 18 calls `.at` while parsing, which is ES2022 and so needs Chrome 92,
Safari 15.4 or Firefox 90. Our floor is chrome90/firefox88/safari14.1/ios14.5
(BUILD_TARGETS in vite.config.ts, mirrored in browserslist), and esbuild lowers
syntax but never built-ins, so Safari and iOS 14.1-15.3 users get a TypeError
from the lexer. The error boundary catches it, so the whole docs panel is
replaced by the error page rather than the markdown degrading.

Reported once from the wild against v3.1.13
(PYTHON-EDITOR-NEXT-3V7) from a browser below the floor, but the same call
fails on Safari versions we do claim to support.

tsconfig's ES2021 lib already stops our own source calling `.at`; this is only
needed because the call is in a dependency.

Prime candidate for removing on next floor bump.
@github-actions

Copy link
Copy Markdown

@microbit-matt-hillsdon microbit-matt-hillsdon changed the title Polyfill Array.prototype.at for browsers below the support floor Polyfill Array.prototype.at mainly for Safari < 15.4, also a win for older Chrome Sep 17, 2026
@microbit-matt-hillsdon microbit-matt-hillsdon changed the title Polyfill Array.prototype.at mainly for Safari < 15.4, also a win for older Chrome Polyfill Array.prototype.at mainly for Safari < 15.4 Sep 17, 2026
Comment thread src/polyfills.ts Outdated
Comment thread src/polyfills.ts Outdated
@microbit-matt-hillsdon
microbit-matt-hillsdon merged commit 58ca8a5 into main Sep 17, 2026
1 check passed
@microbit-matt-hillsdon
microbit-matt-hillsdon deleted the polyfill-array-at branch September 17, 2026 13:33
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.

1 participant