@@ -36,7 +36,7 @@ class TrackSizingParser {
36
36
// console.debug(this.index, char);
37
37
38
38
// Skip whitespace
39
- if ( char === ' ' ) { this . index ++ ; continue ; }
39
+ if ( char === ' ' ) { this . index ++ ; continue ; }
40
40
41
41
if ( TrackSizingParser . INITIAL_CHAR_REGEX . test ( char ) ) {
42
42
const token = this . _parseItem ( ) ;
@@ -51,7 +51,7 @@ class TrackSizingParser {
51
51
}
52
52
}
53
53
54
- throw new Error ( `Invalid start of token ${ char } ` ) ;
54
+ throw new Error ( `Invalid start of token ${ char } ` ) ;
55
55
}
56
56
}
57
57
@@ -98,9 +98,9 @@ function parseRepetition(input) {
98
98
}
99
99
100
100
function parseDimension ( input , options = { allowFrUnits : false } ) {
101
- if ( options . allowFrUnits && input . endsWith ( 'fr' ) ) return { unit : 'fraction' , value : parseFloat ( input . replace ( 'fr' , '' ) ) } ;
102
- if ( input . endsWith ( 'px' ) ) return { unit : 'points ' , value : parseFloat ( input . replace ( 'px' , '' ) ) } ;
103
- if ( input . endsWith ( '%' ) ) return { unit : 'percent' , value : parseFloat ( input . replace ( '%' , '' ) ) / 100 } ;
101
+ if ( options . allowFrUnits && input . endsWith ( 'fr' ) ) return { unit : 'fraction' , value : parseFloat ( input . replace ( 'fr' , '' ) ) } ;
102
+ if ( input . endsWith ( 'px' ) ) return { unit : 'px ' , value : parseFloat ( input . replace ( 'px' , '' ) ) } ;
103
+ if ( input . endsWith ( '%' ) ) return { unit : 'percent' , value : parseFloat ( input . replace ( '%' , '' ) ) / 100 } ;
104
104
if ( input === 'auto' ) return { unit : 'auto' } ;
105
105
if ( input === 'min-content' ) return { unit : 'min-content' } ;
106
106
if ( input === 'max-content' ) return { unit : 'max-content' } ;
@@ -136,15 +136,15 @@ function parseEdges(edges) {
136
136
const right = parseDimension ( edges . right ) ;
137
137
const top = parseDimension ( edges . top ) ;
138
138
const bottom = parseDimension ( edges . bottom ) ;
139
-
139
+
140
140
if ( ! left && ! right && ! top && ! bottom ) return undefined ;
141
141
return { left, right, top, bottom } ;
142
142
}
143
143
144
144
function parseSize ( size ) {
145
145
const width = parseDimension ( size . width ) ;
146
146
const height = parseDimension ( size . height ) ;
147
-
147
+
148
148
if ( ! width && ! height ) return undefined ;
149
149
return { width, height } ;
150
150
}
@@ -155,7 +155,7 @@ function parseGaps(style) {
155
155
return { row : gaps [ 0 ] , column : gaps [ 1 ] ?? gaps [ 0 ] } ;
156
156
}
157
157
if ( style . rowGap || style . columnGap ) {
158
- return { row : parseDimension ( style . rowGap ) , column : parseDimension ( style . columnGap ) }
158
+ return { row : parseDimension ( style . rowGap ) , column : parseDimension ( style . columnGap ) } ;
159
159
}
160
160
return undefined ;
161
161
}
@@ -174,9 +174,9 @@ function parseGridAutoFlow(input) {
174
174
}
175
175
176
176
function parseGridPosition ( input ) {
177
- if ( input === 'auto' ) return { kind : 'auto' }
178
- if ( / ^ s p a n + \d + $ / . test ( input ) ) return { kind : 'span' , value : parseInt ( input . replace ( / [ ^ \d ] / g, '' ) , 10 ) }
179
- if ( / ^ - ? \d + $ / . test ( input ) ) return { kind : 'line' , value : parseInt ( input , 10 ) }
177
+ if ( input === 'auto' ) return { kind : 'auto' } ;
178
+ if ( / ^ s p a n + \d + $ / . test ( input ) ) return { kind : 'span' , value : parseInt ( input . replace ( / [ ^ \d ] / g, '' ) , 10 ) } ;
179
+ if ( / ^ - ? \d + $ / . test ( input ) ) return { kind : 'line' , value : parseInt ( input , 10 ) } ;
180
180
return undefined ;
181
181
}
182
182
@@ -226,9 +226,9 @@ function describeElement(e) {
226
226
227
227
gap : parseGaps ( e . style ) ,
228
228
229
- size : parseSize ( { width : e . style . width , height : e . style . height } ) ,
230
- minSize : parseSize ( { width : e . style . minWidth , height : e . style . minHeight } ) ,
231
- maxSize : parseSize ( { width : e . style . maxWidth , height : e . style . maxHeight } ) ,
229
+ size : parseSize ( { width : e . style . width , height : e . style . height } ) ,
230
+ minSize : parseSize ( { width : e . style . minWidth , height : e . style . minHeight } ) ,
231
+ maxSize : parseSize ( { width : e . style . maxWidth , height : e . style . maxHeight } ) ,
232
232
aspectRatio : parseRatio ( e . style . aspectRatio ) ,
233
233
234
234
margin : parseEdges ( {
@@ -295,7 +295,7 @@ function describeElement(e) {
295
295
useRounding : e . getAttribute ( "data-test-rounding" ) !== "false" ,
296
296
297
297
children : Array . from ( e . children ) . map ( c => describeElement ( c ) ) ,
298
- }
298
+ } ;
299
299
}
300
300
301
301
// Useful when developing this script. Logs the parsed style to the console when any test fixture is opened in a browser.
@@ -305,4 +305,4 @@ window.onload = function () {
305
305
} catch ( e ) {
306
306
console . error ( e ) ;
307
307
}
308
- }
308
+ } ;
0 commit comments