File tree 3 files changed +27
-1
lines changed
3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,10 @@ pub trait PseudoElement<'i>: Sized + ToCss {
44
44
fn is_view_transition ( & self ) -> bool {
45
45
false
46
46
}
47
+
48
+ fn is_unknown ( & self ) -> bool {
49
+ false
50
+ }
47
51
}
48
52
49
53
/// A trait that represents a pseudo-class.
@@ -2600,7 +2604,10 @@ where
2600
2604
builder. push_simple_selector ( Component :: Slotted ( selector) ) ;
2601
2605
}
2602
2606
SimpleSelectorParseResult :: PseudoElement ( p) => {
2607
+ if !p. is_unknown ( ) {
2603
2608
state. insert ( SelectorParsingState :: AFTER_PSEUDO_ELEMENT ) ;
2609
+ builder. push_combinator ( Combinator :: PseudoElement ) ;
2610
+ }
2604
2611
if !p. accepts_state_pseudo_classes ( ) {
2605
2612
state. insert ( SelectorParsingState :: AFTER_NON_STATEFUL_PSEUDO_ELEMENT ) ;
2606
2613
}
@@ -2610,7 +2617,6 @@ where
2610
2617
if p. is_view_transition ( ) {
2611
2618
state. insert ( SelectorParsingState :: AFTER_VIEW_TRANSITION ) ;
2612
2619
}
2613
- builder. push_combinator ( Combinator :: PseudoElement ) ;
2614
2620
builder. push_simple_selector ( Component :: PseudoElement ( p) ) ;
2615
2621
}
2616
2622
}
Original file line number Diff line number Diff line change @@ -6668,6 +6668,19 @@ mod tests {
6668
6668
ParserError::SelectorError(SelectorError::InvalidState),
6669
6669
);
6670
6670
}
6671
+
6672
+ minify_test(".foo ::deep .bar {width: 20px}", ".foo ::deep .bar{width:20px}");
6673
+ minify_test(".foo::deep .bar {width: 20px}", ".foo::deep .bar{width:20px}");
6674
+ minify_test(".foo ::deep.bar {width: 20px}", ".foo ::deep.bar{width:20px}");
6675
+ minify_test(".foo ::unknown .bar {width: 20px}", ".foo ::unknown .bar{width:20px}");
6676
+ minify_test(
6677
+ ".foo ::unknown(foo) .bar {width: 20px}",
6678
+ ".foo ::unknown(foo) .bar{width:20px}",
6679
+ );
6680
+ minify_test(
6681
+ ".foo ::unknown:only-child {width: 20px}",
6682
+ ".foo ::unknown:only-child{width:20px}",
6683
+ );
6671
6684
}
6672
6685
6673
6686
#[test]
Original file line number Diff line number Diff line change @@ -1131,6 +1131,13 @@ impl<'i> parcel_selectors::parser::PseudoElement<'i> for PseudoElement<'i> {
1131
1131
| PseudoElement :: ViewTransitionOld { .. }
1132
1132
)
1133
1133
}
1134
+
1135
+ fn is_unknown ( & self ) -> bool {
1136
+ matches ! (
1137
+ * self ,
1138
+ PseudoElement :: Custom { .. } | PseudoElement :: CustomFunction { .. } ,
1139
+ )
1140
+ }
1134
1141
}
1135
1142
1136
1143
impl < ' i > PseudoElement < ' i > {
You can’t perform that action at this time.
0 commit comments