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

Commit 87fa2e8

Browse files
fix: do not tread negative values as identifiers in the animation shorthand (#68)
1 parent 7f06bbb commit 87fa2e8

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

‎src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ function localizeDeclaration(declaration, context) {
357357

358358
// We don't validate `hex digits`, because we don't need it, it is work of linters.
359359
const validIdent =
360-
/^-?([a-z\u0080-\uFFFF_]|(\\[^\r\n\f])|-)((\\[^\r\n\f])|[a-z\u0080-\uFFFF_0-9-])*$/i;
360+
/^-?([a-z\u0080-\uFFFF_]|(\\[^\r\n\f])|-(?![0-9]))((\\[^\r\n\f])|[a-z\u0080-\uFFFF_0-9-])*$/i;
361361

362362
/*
363363
The spec defines some keywords that you can use to describe properties such as the timing

‎test/index.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,21 @@ const tests = [
864864
options: { mode: "pure" },
865865
expected: ":export { foo: __foo; }",
866866
},
867+
{
868+
name: "handle negative animation-delay in animation shorthand",
869+
input: ".foo { animation: 1s -500ms; }",
870+
expected: ":local(.foo) { animation: 1s -500ms; }",
871+
},
872+
{
873+
name: "handle negative animation-delay in animation shorthand #1",
874+
input: ".foo { animation: 1s -500.0ms; }",
875+
expected: ":local(.foo) { animation: 1s -500.0ms; }",
876+
},
877+
{
878+
name: "handle negative animation-delay in animation shorthand #2",
879+
input: ".foo { animation: 1s -500.0ms -a_value; }",
880+
expected: ":local(.foo) { animation: 1s -500.0ms :local(-a_value); }",
881+
},
867882
];
868883

869884
function process(css, options) {

0 commit comments

Comments
(0)

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