Skip to content

Commit

Permalink
Fix CSS parser to read % as an unit value for expressions like $%(10)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanchuan committed Sep 14, 2023
1 parent 7f6af12 commit 31e0791
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/parser/parse-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,10 @@ function read_func(it, variables = {}) {
func.arguments = args;
func.variables = variables;
break;
} else if (/[0-9a-zA-Z_\-.]/.test(c)) {
} else if (/[0-9a-zA-Z_\-.%]/.test(c)) {
name += c;
}
if (!has_argument && next !== '(' && !/[0-9a-zA-Z_\-.]/.test(next)) {
if (!has_argument && next !== '(' && !/[0-9a-zA-Z_\-.%]/.test(next)) {
break;
}
it.next();
Expand Down Expand Up @@ -518,7 +518,7 @@ function read_value(it) {
}
break;
}
else if ((c === '@' || c === '$') && /[\w-\(]/.test(it.curr(1))) {
else if ((c === '@' || c === '$') && /[\w-\(%]/.test(it.curr(1))) {
if (text.value.length) {
value[idx].push(text);
text = Tokens.text();
Expand Down

0 comments on commit 31e0791

Please sign in to comment.