Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commit dd8bb13

Browse files
committed
Fix parseTransition bug
1 parent 6d9e4e5 commit dd8bb13

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

‎src/utils/parseTransition.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ describe("parseTransition", () => {
1919
{ property: "height", duration: 3000, delay: 2000 },
2020
],
2121
],
22+
[
23+
"transform 100ms cubic-bezier(0.4, 0.0, 0.6, 1) 150ms",
24+
[
25+
{ property: "transform", duration: 100, delay: 150 },
26+
{ property: "transform", duration: 100, delay: 150 },
27+
],
28+
],
2229
];
2330
cases.forEach((c) => assert.deepEqual(parseTransition(c[0] as string), c[1]));
2431
});

‎src/utils/parseTransition.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ export function parseTransition(transition: string): [TransitionEntry, Transitio
1111
let firstProperty: TransitionEntry = null;
1212
let lastPropertyTotalDuration = -1;
1313
let firstPropertyDelay = 99999999;
14-
transition.split(/\s*,\s*/).forEach(
14+
transition.split(/\s*,\s*(?![^\(]*\))/g).forEach(
1515
(entry) => {
16-
const parts = entry.split(/\s+/);
16+
const parts = entry.split(/\s+(?![^\(]*\))/g);
1717
const property = parts.filter((p) => p.match(/^[a-z\-A-Z]+$/))[0];
1818
const [duration = 0, delay = 0] = parts.filter((p) => p.match(/^[0-9]+m?s$/)).map((p) => parseDuration(p));
1919
const totalDuration = duration + delay;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /