Skip to content

Commit e66cb3c

Browse files
kogaievilebottnawi
authored andcommitted
fix: inappropriate modification of animation keywords (#5)
1 parent 38bb518 commit e66cb3c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,12 @@ function localizeAnimationShorthandDeclValues(decl, context) {
243243
};
244244

245245
const didParseAnimationName = false;
246-
const parsedAnimationKeywords = {};
246+
let parsedAnimationKeywords = {};
247247
const valueNodes = valueParser(decl.value).walk((node) => {
248+
/* If div-token appeared (represents as comma ','), a possibility of an animation-keywords should be reflesh. */
249+
if (node.type === 'div') {
250+
parsedAnimationKeywords = {};
251+
}
248252
const value =
249253
node.type === 'word' ? node.value.toLowerCase() : null;
250254

test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,13 @@ const tests = [
191191
expected:
192192
':local(.foo) { animation: 1s normal ease-out infinite :local(foo); }'
193193
},
194+
{
195+
should:
196+
'not treat animation curve as identifier of animation name even if it separated by comma',
197+
input: '.foo { animation: slide-right 300ms forwards ease-out, fade-in 300ms forwards ease-out; }',
198+
expected:
199+
':local(.foo) { animation: :local(slide-right) 300ms forwards ease-out, :local(fade-in) 300ms forwards ease-out; }'
200+
},
194201
{
195202
should: 'handle animations with custom timing functions',
196203
input:

0 commit comments

Comments
 (0)