@@ -9,7 +9,6 @@ const REGEX_PERCENTAGE = /^\d+(\.\d+)?%/;
9
9
const REGEX_NTH_OF =
10
10
/ ^ ( e v e n | o d d | \+ ? ( \d + | \d * n ( \s * [ + - ] \s * \d + ) ? ) | - \d * n ( \s * \+ \s * \d + ) ) ( (? = \s * [ , ) ] ) | \s + o f \s + ) / ;
11
11
const REGEX_WHITESPACE_OR_COLON = / [ \s : ] / ;
12
- const REGEX_BRACE_OR_SEMICOLON = / [ { ; ] (? = (?: [ ^ ' " ] * ' [ ^ ' " ] * ' ) * [ ^ ' " ] * $ ) / ;
13
12
const REGEX_LEADING_HYPHEN_OR_DIGIT = / - ? \d / ;
14
13
const REGEX_VALID_IDENTIFIER_CHAR = / [ a - z A - Z 0 - 9 _ - ] / ;
15
14
const REGEX_COMMENT_CLOSE = / \* \/ / ;
@@ -79,7 +78,7 @@ function read_at_rule(parser) {
79
78
80
79
const name = read_identifier ( parser ) ;
81
80
82
- const prelude = parser . read_until ( REGEX_BRACE_OR_SEMICOLON ) . trim ( ) ;
81
+ const prelude = read_value ( parser ) ;
83
82
84
83
/** @type {import('#compiler').Css.Block | null } */
85
84
let block = null ;
@@ -398,7 +397,7 @@ function read_declaration(parser) {
398
397
parser . eat ( ':' ) ;
399
398
parser . allow_whitespace ( ) ;
400
399
401
- const value = read_declaration_value ( parser ) ;
400
+ const value = read_value ( parser ) ;
402
401
403
402
const end = parser . index ;
404
403
@@ -419,7 +418,7 @@ function read_declaration(parser) {
419
418
* @param {import('../index.js').Parser } parser
420
419
* @returns {string }
421
420
*/
422
- function read_declaration_value ( parser ) {
421
+ function read_value ( parser ) {
423
422
let value = '' ;
424
423
let escaped = false ;
425
424
let in_url = false ;
@@ -443,7 +442,7 @@ function read_declaration_value(parser) {
443
442
quote_mark = char ;
444
443
} else if ( char === '(' && value . slice ( - 3 ) === 'url' ) {
445
444
in_url = true ;
446
- } else if ( ( char === ';' || char === '}' ) && ! in_url && ! quote_mark ) {
445
+ } else if ( ( char === ';' || char === '{' || char === ' }') && ! in_url && ! quote_mark ) {
447
446
return value . trim ( ) ;
448
447
}
449
448
0 commit comments