Skip to content

Commit

Permalink
Fix bug in animation range name regex
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesodland committed Dec 24, 2023
1 parent 0803f77 commit e0490f8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/proxy-animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const nativeElementAnimate = window.Element.prototype.animate;
const nativeAnimation = window.Animation;

export const ANIMATION_RANGE_NAMES = ['entry', 'exit', 'cover', 'contain', 'entry-crossing', 'exit-crossing'];
const rangeNameRegExp = new RegExp(`(${ANIMATION_RANGE_NAMES.map(rangeName => `${rangeName}(?!-)`).join('|')})`);

class PromiseWrapper {
constructor() {
Expand Down Expand Up @@ -1775,7 +1776,7 @@ function parseTimelineRangeOffset(value, position) {
}
// Author passed in something like `"cover 100%"`
else {
const parts = value.split(new RegExp(`(${ANIMATION_RANGE_NAMES.join('|')})`)).map(part => part.trim()).filter(Boolean);
const parts = value.split(rangeNameRegExp).map(part => part.trim()).filter(Boolean);

if (parts.length === 1) {
if (ANIMATION_RANGE_NAMES.includes(parts[0])) {
Expand Down

0 comments on commit e0490f8

Please sign in to comment.