diff --git a/index.js b/index.js index 6c81ff8..e2e2791 100644 --- a/index.js +++ b/index.js @@ -243,8 +243,12 @@ function localizeAnimationShorthandDeclValues(decl, context) { }; const didParseAnimationName = false; - const parsedAnimationKeywords = {}; + let parsedAnimationKeywords = {}; const valueNodes = valueParser(decl.value).walk((node) => { + /* If div-token appeared (represents as comma ','), a possibility of an animation-keywords should be reflesh. */ + if (node.type === 'div') { + parsedAnimationKeywords = {}; + } const value = node.type === 'word' ? node.value.toLowerCase() : null; diff --git a/test.js b/test.js index 51253cb..9ec62ff 100644 --- a/test.js +++ b/test.js @@ -191,6 +191,13 @@ const tests = [ expected: ':local(.foo) { animation: 1s normal ease-out infinite :local(foo); }' }, + { + should: + 'not treat animation curve as identifier of animation name even if it separated by comma', + input: '.foo { animation: slide-right 300ms forwards ease-out, fade-in 300ms forwards ease-out; }', + expected: + ':local(.foo) { animation: :local(slide-right) 300ms forwards ease-out, :local(fade-in) 300ms forwards ease-out; }' + }, { should: 'handle animations with custom timing functions', input: