@projectwallace/css-parser 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,7 +2,7 @@ import { Lexer } from './tokenize.js';
|
|
|
2
2
|
import { CSSDataArena, DECLARATION, FLAG_IMPORTANT, FLAG_BROWSERHACK } from './arena.js';
|
|
3
3
|
import { ValueParser } from './parse-value.js';
|
|
4
4
|
import { is_vendor_prefixed } from './string-utils.js';
|
|
5
|
-
import { TOKEN_AT_KEYWORD, TOKEN_HASH, TOKEN_IDENT, TOKEN_DELIM, TOKEN_LEFT_PAREN, TOKEN_RIGHT_PAREN, TOKEN_LEFT_BRACKET, TOKEN_RIGHT_BRACKET, TOKEN_COMMA, TOKEN_COLON, TOKEN_EOF, TOKEN_SEMICOLON, TOKEN_RIGHT_BRACE, TOKEN_LEFT_BRACE } from './token-types.js';
|
|
5
|
+
import { TOKEN_AT_KEYWORD, TOKEN_HASH, TOKEN_IDENT, TOKEN_DELIM, TOKEN_LEFT_PAREN, TOKEN_RIGHT_PAREN, TOKEN_LEFT_BRACKET, TOKEN_RIGHT_BRACKET, TOKEN_COMMA, TOKEN_COLON, TOKEN_EOF, TOKEN_SEMICOLON, TOKEN_RIGHT_BRACE, TOKEN_LEFT_BRACE, TOKEN_FUNCTION } from './token-types.js';
|
|
6
6
|
import { trim_boundaries } from './parse-utils.js';
|
|
7
7
|
import { CSSNode } from './css-node.js';
|
|
8
8
|
|
|
@@ -97,10 +97,16 @@ class DeclarationParser {
|
|
|
97
97
|
let value_end = value_start;
|
|
98
98
|
let has_important = false;
|
|
99
99
|
let last_end = lexer.token_end;
|
|
100
|
+
let paren_depth = 0;
|
|
100
101
|
while (lexer.token_type !== TOKEN_EOF && lexer.token_start < end) {
|
|
101
102
|
let token_type = lexer.token_type;
|
|
102
|
-
if (token_type ===
|
|
103
|
-
|
|
103
|
+
if (token_type === TOKEN_LEFT_PAREN || token_type === TOKEN_FUNCTION) {
|
|
104
|
+
paren_depth++;
|
|
105
|
+
} else if (token_type === TOKEN_RIGHT_PAREN) {
|
|
106
|
+
paren_depth--;
|
|
107
|
+
}
|
|
108
|
+
if (token_type === TOKEN_SEMICOLON && paren_depth === 0) break;
|
|
109
|
+
if (token_type === TOKEN_RIGHT_BRACE && paren_depth === 0) break;
|
|
104
110
|
if (token_type === TOKEN_LEFT_BRACE) {
|
|
105
111
|
lexer.restore_position(saved);
|
|
106
112
|
return null;
|
package/package.json
CHANGED