Skip to content

Fix inappropriate modification of animation keywords #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 21, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
7 changes: 7 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: 1s normal ease-out infinite, 1s normal ease-out infinite; }',
expected:
':local(.foo) { animation: 1s normal ease-out infinite, 1s normal ease-out infinite; }'
},
{
should: 'handle animations with custom timing functions',
input:
Expand Down