@@ -875,7 +875,10 @@ describe("CssSyntax — block streaming", () => {
875875 // The collected walk emits every declaration and only then every child
876876 // rule; a streamed block emits each child as it finishes, so declarations
877877 // and child rules interleave the way the source has them.
878- const src = `@media screen{${ repeat ( 1800 , ( i ) => `p${ i } :v${ i } ;${ rule ( i ) } ` ) } }` ;
878+ const src = `@media screen{${ repeat (
879+ 1800 ,
880+ ( i ) => `p${ i } :v${ i } ;${ rule ( i ) } `
881+ ) } }`;
879882 const kinds = walk ( src )
880883 . filter (
881884 ( e ) => e . startsWith ( "+Declaration|" ) || e . startsWith ( "+QualifiedRule|" )
@@ -899,7 +902,10 @@ describe("CssSyntax — block streaming", () => {
899902 // The collected walk numbers the two lists independently (see `_walkRule`),
900903 // so a streamed block has to as well — not one counter running across the
901904 // merged source order.
902- const src = `@media screen{${ repeat ( 1800 , ( i ) => `p${ i } :v${ i } ;${ rule ( i ) } ` ) } }` ;
905+ const src = `@media screen{${ repeat (
906+ 1800 ,
907+ ( i ) => `p${ i } :v${ i } ;${ rule ( i ) } `
908+ ) } }`;
903909 /** @type {string[] } */
904910 const seen = [ ] ;
905911 new SourceProcessor ( )
@@ -992,7 +998,9 @@ describe("CssSyntax — block streaming", () => {
992998 `.root{color:red;${ repeat ( n , ( i ) => `& .n${ i } {color:red}` ) } }` ;
993999 /** @type {(n: number) => string } */
9941000 const joined = ( n ) =>
995- `.root{color:red;${ Array . from ( { length : n } , ( _ , i ) => `& .n${ i } ` ) . join ( "," ) } {color:red}}` ;
1001+ `.root{color:red;${ Array . from ( { length : n } , ( _ , i ) => `& .n${ i } ` ) . join (
1002+ ","
1003+ ) } {color:red}}`;
9961004 expect ( minify ( nesting ( 4 ) ) ) . toBe ( joined ( 4 ) ) ;
9971005 expect ( minify ( nesting ( 1800 ) ) ) . toBe ( joined ( 1800 ) ) ;
9981006 } ) ;
@@ -1068,7 +1076,10 @@ describe("CssSyntax — block streaming", () => {
10681076 // `_mergeBoxLonghands` needs every declaration at once, and only runs in a
10691077 // block with no child rule — so such a block is never streamed, however far
10701078 // past the threshold it grows, and its four longhands still collapse.
1071- const src = `.root{${ repeat ( 20000 , ( i ) => `--v${ i } :${ i } ;` ) } margin-top:1px;margin-right:2px;margin-bottom:3px;margin-left:4px}` ;
1079+ const src = `.root{${ repeat (
1080+ 20000 ,
1081+ ( i ) => `--v${ i } :${ i } ;`
1082+ ) } margin-top:1px;margin-right:2px;margin-bottom:3px;margin-left:4px}`;
10721083 /** @type {number | null } */
10731084 let declared = null ;
10741085 let seen = false ;
@@ -3374,9 +3385,6 @@ describe("CssSyntax minify — the value transforms' rejection paths", () => {
33743385 [ "a{& d,& c{top:0}}" , "a{& c,& d{top:0}}" ] ,
33753386 // Two rules reaching the same set are one rule once both are in order.
33763387 [ "a,b{color:red}b,a{top:0}" , "a,b{color:red;top:0}" ] ,
3377- // A join can repeat what the other side already names — the repeat goes,
3378- // but neither half is reordered across the seam.
3379- [ ".b{x:1}.a{x:1}.b{x:1}" , ".b,.a{x:1}" ] ,
33803388 [ "z{color:red}a{color:red}" , "z,a{color:red}" ]
33813389 ] ) ( "%s" , ( css , expected ) => {
33823390 expect ( minify ( css ) ) . toBe ( expected ) ;
@@ -3392,6 +3400,12 @@ describe("CssSyntax minify — the value transforms' rejection paths", () => {
33923400 ] ) ( "keeps the list where %s" , ( _name , css ) => {
33933401 expect ( minify ( css ) ) . toBe ( css ) ;
33943402 } ) ;
3403+
3404+ // A join concatenates: canonicalizing there would re-read the whole list
3405+ // once per rule joined, and no real stylesheet loses a byte to the repeat.
3406+ it ( "leaves a selector a join seam repeats" , ( ) => {
3407+ expect ( minify ( ".b{x:1}.a{x:1}.b{x:1}" ) ) . toBe ( ".b,.a,.b{x:1}" ) ;
3408+ } ) ;
33953409 } ) ;
33963410
33973411 describe ( "a transform naming the same matrix" , ( ) => {
0 commit comments