File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -82,14 +82,25 @@ function expandRule(node: AstRule): Array<AstRule | AstAtRule> {
8282 if ( ! rule . sel . includes ( '&' ) ) {
8383
8484 const selRule : string [ ] [ ] = splitRule ( rule . sel ) ;
85- selRule . forEach ( arr => combinators . includes ( arr [ 0 ] . charAt ( 0 ) ) ? arr . unshift ( ast . sel ) : arr . unshift ( ast . sel , ' ' ) ) ;
8685
87- rule . sel = selRule . reduce ( ( acc : string [ ] , curr : string [ ] ) => {
86+ if ( selRule . length > 1 ) {
8887
89- acc . push ( curr . join ( '' ) ) ;
88+ const r : string = ':is(' + selRule . map ( a => a . join ( '' ) ) . join ( ',' ) + ')' ;
89+
90+ rule . sel = splitRule ( ast . sel ) . reduce ( ( a , b ) => a . concat ( [ b . join ( '' ) + r ] ) , < string [ ] > [ ] ) . join ( ',' ) ;
91+ }
92+
93+ else {
94+
95+ selRule . forEach ( arr => combinators . includes ( arr [ 0 ] . charAt ( 0 ) ) ? arr . unshift ( ast . sel ) : arr . unshift ( ast . sel , ' ' ) ) ;
96+ rule . sel = selRule . reduce ( ( acc : string [ ] , curr : string [ ] ) => {
97+
98+ acc . push ( curr . join ( '' ) ) ;
99+
100+ return acc ;
101+ } , < string [ ] > [ ] ) . join ( ',' ) ;
102+ }
90103
91- return acc ;
92- } , < string [ ] > [ ] ) . join ( ',' ) ;
93104 } else {
94105
95106 rule . sel = replaceCompound ( rule . sel , ast . sel ) ;
You can’t perform that action at this time.
0 commit comments