@@ -423,6 +423,9 @@ impl TokenSerializationType {
423
423
/// so that they are not re-parsed as a single token.
424
424
///
425
425
/// See https://drafts.csswg.org/css-syntax/#serialization
426
+ ///
427
+ /// See https://github.com/w3c/csswg-drafts/issues/4088 for the
428
+ /// `DelimPercent` bits.
426
429
pub fn needs_separator_when_before ( self , other : TokenSerializationType ) -> bool {
427
430
use self :: TokenSerializationTypeVariants :: * ;
428
431
match self . 0 {
@@ -442,17 +445,21 @@ impl TokenSerializationType {
442
445
other. 0 ,
443
446
Ident | Function | UrlOrBadUrl | DelimMinus | Number | Percentage | Dimension | CDC
444
447
) ,
445
- DelimHash | DelimMinus | Number => matches ! (
448
+ DelimHash | DelimMinus => matches ! (
446
449
other. 0 ,
447
450
Ident | Function | UrlOrBadUrl | DelimMinus | Number | Percentage | Dimension
448
451
) ,
452
+ Number => matches ! (
453
+ other. 0 ,
454
+ Ident | Function | UrlOrBadUrl | DelimMinus | Number | Percentage | DelimPercent | Dimension
455
+ ) ,
449
456
DelimAt => matches ! ( other. 0 , Ident | Function | UrlOrBadUrl | DelimMinus ) ,
450
457
DelimDotOrPlus => matches ! ( other. 0 , Number | Percentage | Dimension ) ,
451
458
DelimAssorted | DelimAsterisk => matches ! ( other. 0 , DelimEquals ) ,
452
459
DelimBar => matches ! ( other. 0 , DelimEquals | DelimBar | DashMatch ) ,
453
460
DelimSlash => matches ! ( other. 0 , DelimAsterisk | SubstringMatch ) ,
454
461
Nothing | WhiteSpace | Percentage | UrlOrBadUrl | Function | CDC | OpenParen
455
- | DashMatch | SubstringMatch | DelimQuestion | DelimEquals | Other => false ,
462
+ | DashMatch | SubstringMatch | DelimQuestion | DelimEquals | DelimPercent | Other => false ,
456
463
}
457
464
}
458
465
}
@@ -482,6 +489,7 @@ enum TokenSerializationTypeVariants {
482
489
DelimBar , // '|'
483
490
DelimSlash , // '/'
484
491
DelimAsterisk , // '*'
492
+ DelimPercent , // '%'
485
493
Other , // anything else
486
494
}
487
495
@@ -502,6 +510,7 @@ impl<'a> Token<'a> {
502
510
Token :: Delim ( '-' ) => DelimMinus ,
503
511
Token :: Delim ( '?' ) => DelimQuestion ,
504
512
Token :: Delim ( '$' ) | Token :: Delim ( '^' ) | Token :: Delim ( '~' ) => DelimAssorted ,
513
+ Token :: Delim ( '%' ) => DelimPercent ,
505
514
Token :: Delim ( '=' ) => DelimEquals ,
506
515
Token :: Delim ( '|' ) => DelimBar ,
507
516
Token :: Delim ( '/' ) => DelimSlash ,
0 commit comments