Skip to content

fix: avoid Array.prototype.at() to support the declared browser range#602

Merged
mrholek merged 1 commit into
mainfrom
fix/array-at-browser-support
Jul 14, 2026
Merged

fix: avoid Array.prototype.at() to support the declared browser range#602
mrholek merged 1 commit into
mainfrom
fix/array-at-browser-support

Conversation

@mrholek

@mrholek mrholek commented Jul 14, 2026

Copy link
Copy Markdown
Member

Completes #565.

Array.prototype.at() requires Chrome 92 / Safari 15.4 / iOS 15.4, but the committed .browserslistrc declares Chrome >= 60, Safari >= 12, iOS >= 12, and the build only transpiles syntax — it does not polyfill (.babelrc.js has no useBuiltIns). So on the supported older browsers .at() is undefined and throws.

#565 fixed only the two calendar usages. This replaces all .at() calls in js/src:

  • util/calendar.jsweeks.at(-1)weeks[weeks.length - 1] (×2)
  • chip-input.jschips.at(-1) / parts.at(-1) → index access (×4)
  • chip-set.jschips.at(targetIndex)chips[targetIndex < 0 ? chips.length + targetIndex : targetIndex] (preserves negative-index semantics; _navigateToEdge is called with 0 and -1)

Behavior is unchanged; existing chip/calendar suites pass (2994). Original calendar fix by @vladrusu (#565).

Array.prototype.at() requires Chrome 92 / Safari 15.4 / iOS 15.4, but
.browserslistrc declares Chrome >= 60 and Safari >= 12, and the build does not
polyfill (no useBuiltIns). Replace .at(-1) with index access so ChipInput,
ChipSet and the calendar util run on the supported browsers.
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 29295672217

Coverage increased (+0.02%) to 94.655%

Details

  • Coverage increased (+0.02%) from the base build.
  • Patch coverage: 7 of 7 lines across 3 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 7462
Covered Lines: 7187
Line Coverage: 96.31%
Relevant Branches: 3090
Covered Branches: 2801
Branch Coverage: 90.65%
Branches in Coverage %: Yes
Coverage Strength: 805.57 hits per line

💛 - Coveralls

@mrholek mrholek merged commit e084cd5 into main Jul 14, 2026
7 checks passed
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.

2 participants