@@ -849,7 +849,10 @@ describe("CssSyntax — block streaming", () => {
849849 // The collected walk emits every declaration and only then every child
850850 // rule; a streamed block emits each child as it finishes, so declarations
851851 // and child rules interleave the way the source has them.
852- const src = `@media screen{${ repeat ( 1800 , ( i ) => `p${ i } :v${ i } ;${ rule ( i ) } ` ) } }` ;
852+ const src = `@media screen{${ repeat (
853+ 1800 ,
854+ ( i ) => `p${ i } :v${ i } ;${ rule ( i ) } `
855+ ) } }`;
853856 const kinds = walk ( src )
854857 . filter (
855858 ( e ) => e . startsWith ( "+Declaration|" ) || e . startsWith ( "+QualifiedRule|" )
@@ -873,7 +876,10 @@ describe("CssSyntax — block streaming", () => {
873876 // The collected walk numbers the two lists independently (see `_walkRule`),
874877 // so a streamed block has to as well — not one counter running across the
875878 // merged source order.
876- const src = `@media screen{${ repeat ( 1800 , ( i ) => `p${ i } :v${ i } ;${ rule ( i ) } ` ) } }` ;
879+ const src = `@media screen{${ repeat (
880+ 1800 ,
881+ ( i ) => `p${ i } :v${ i } ;${ rule ( i ) } `
882+ ) } }`;
877883 /** @type {string[] } */
878884 const seen = [ ] ;
879885 new SourceProcessor ( )
@@ -966,7 +972,9 @@ describe("CssSyntax — block streaming", () => {
966972 `.root{color:red;${ repeat ( n , ( i ) => `& .n${ i } {color:red}` ) } }` ;
967973 /** @type {(n: number) => string } */
968974 const joined = ( n ) =>
969- `.root{color:red;${ Array . from ( { length : n } , ( _ , i ) => `& .n${ i } ` ) . join ( "," ) } {color:red}}` ;
975+ `.root{color:red;${ Array . from ( { length : n } , ( _ , i ) => `& .n${ i } ` ) . join (
976+ ","
977+ ) } {color:red}}`;
970978 expect ( minify ( nesting ( 4 ) ) ) . toBe ( joined ( 4 ) ) ;
971979 expect ( minify ( nesting ( 1800 ) ) ) . toBe ( joined ( 1800 ) ) ;
972980 } ) ;
@@ -1042,7 +1050,10 @@ describe("CssSyntax — block streaming", () => {
10421050 // `_mergeBoxLonghands` needs every declaration at once, and only runs in a
10431051 // block with no child rule — so such a block is never streamed, however far
10441052 // past the threshold it grows, and its four longhands still collapse.
1045- const src = `.root{${ repeat ( 20000 , ( i ) => `--v${ i } :${ i } ;` ) } margin-top:1px;margin-right:2px;margin-bottom:3px;margin-left:4px}` ;
1053+ const src = `.root{${ repeat (
1054+ 20000 ,
1055+ ( i ) => `--v${ i } :${ i } ;`
1056+ ) } margin-top:1px;margin-right:2px;margin-bottom:3px;margin-left:4px}`;
10461057 /** @type {number | null } */
10471058 let declared = null ;
10481059 let seen = false ;
@@ -3267,9 +3278,6 @@ describe("CssSyntax minify — the value transforms' rejection paths", () => {
32673278 [ "a{& d,& c{top:0}}" , "a{& c,& d{top:0}}" ] ,
32683279 // Two rules reaching the same set are one rule once both are in order.
32693280 [ "a,b{color:red}b,a{top:0}" , "a,b{color:red;top:0}" ] ,
3270- // A join can repeat what the other side already names — the repeat goes,
3271- // but neither half is reordered across the seam.
3272- [ ".b{x:1}.a{x:1}.b{x:1}" , ".b,.a{x:1}" ] ,
32733281 [ "z{color:red}a{color:red}" , "z,a{color:red}" ]
32743282 ] ) ( "%s" , ( css , expected ) => {
32753283 expect ( minify ( css ) ) . toBe ( expected ) ;
@@ -3285,6 +3293,12 @@ describe("CssSyntax minify — the value transforms' rejection paths", () => {
32853293 ] ) ( "keeps the list where %s" , ( _name , css ) => {
32863294 expect ( minify ( css ) ) . toBe ( css ) ;
32873295 } ) ;
3296+
3297+ // A join concatenates: canonicalizing there would re-read the whole list
3298+ // once per rule joined, and no real stylesheet loses a byte to the repeat.
3299+ it ( "leaves a selector a join seam repeats" , ( ) => {
3300+ expect ( minify ( ".b{x:1}.a{x:1}.b{x:1}" ) ) . toBe ( ".b,.a,.b{x:1}" ) ;
3301+ } ) ;
32883302 } ) ;
32893303
32903304 describe ( "a transform naming the same matrix" , ( ) => {
0 commit comments