File tree Expand file tree Collapse file tree 3 files changed +31
-2
lines changed Expand file tree Collapse file tree 3 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -1302,7 +1302,7 @@ impl NthSelectorData {
1302
1302
1303
1303
/// Writes the beginning of the selector.
1304
1304
#[ inline]
1305
- fn write_start < W : fmt:: Write > ( & self , dest : & mut W , is_function : bool ) -> fmt:: Result {
1305
+ pub fn write_start < W : fmt:: Write > ( & self , dest : & mut W , is_function : bool ) -> fmt:: Result {
1306
1306
dest. write_str ( match self . ty {
1307
1307
NthType :: Child if is_function => ":nth-child(" ,
1308
1308
NthType :: Child => ":first-child" ,
@@ -1322,7 +1322,7 @@ impl NthSelectorData {
1322
1322
/// Serialize <an+b> (part of the CSS Syntax spec, but currently only used here).
1323
1323
/// <https://drafts.csswg.org/css-syntax-3/#serialize-an-anb-value>
1324
1324
#[ inline]
1325
- fn write_affine < W : fmt:: Write > ( & self , dest : & mut W ) -> fmt:: Result {
1325
+ pub fn write_affine < W : fmt:: Write > ( & self , dest : & mut W ) -> fmt:: Result {
1326
1326
match ( self . a , self . b ) {
1327
1327
( 0 , 0 ) => dest. write_char ( '0' ) ,
1328
1328
Original file line number Diff line number Diff line change @@ -24993,6 +24993,27 @@ mod tests {
24993
24993
Default::default(),
24994
24994
true,
24995
24995
);
24996
+
24997
+ css_modules_test(
24998
+ ":nth-child(1 of .foo) {width: 20px}",
24999
+ ":nth-child(1 of .EgL3uq_foo){width:20px}",
25000
+ map! {
25001
+ "foo" => "EgL3uq_foo"
25002
+ },
25003
+ HashMap::new(),
25004
+ Default::default(),
25005
+ true,
25006
+ );
25007
+ css_modules_test(
25008
+ ":nth-last-child(1 of .foo) {width: 20px}",
25009
+ ":nth-last-child(1 of .EgL3uq_foo){width:20px}",
25010
+ map! {
25011
+ "foo" => "EgL3uq_foo"
25012
+ },
25013
+ HashMap::new(),
25014
+ Default::default(),
25015
+ true,
25016
+ );
24996
25017
}
24997
25018
24998
25019
// Stable hashes between project roots.
Original file line number Diff line number Diff line change @@ -1622,6 +1622,14 @@ where
1622
1622
selector. to_css ( dest) ?;
1623
1623
dest. write_char ( ')' )
1624
1624
}
1625
+ Component :: NthOf ( ref nth_of_data) => {
1626
+ let nth_data = nth_of_data. nth_data ( ) ;
1627
+ nth_data. write_start ( dest, true ) ?;
1628
+ nth_data. write_affine ( dest) ?;
1629
+ dest. write_str ( " of " ) ?;
1630
+ serialize_selector_list ( nth_of_data. selectors ( ) . iter ( ) , dest, context, true ) ?;
1631
+ dest. write_char ( ')' )
1632
+ }
1625
1633
_ => {
1626
1634
cssparser:: ToCss :: to_css ( component, dest) ?;
1627
1635
Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments