File tree 1 file changed +48
-48
lines changed 1 file changed +48
-48
lines changed Original file line number Diff line number Diff line change 1
- let unitlessKeys = {
2
- animationIterationCount : 1 ,
3
- borderImageOutset : 1 ,
4
- borderImageSlice : 1 ,
5
- borderImageWidth : 1 ,
6
- boxFlex : 1 ,
7
- boxFlexGroup : 1 ,
8
- boxOrdinalGroup : 1 ,
9
- columnCount : 1 ,
10
- columns : 1 ,
11
- flex : 1 ,
12
- flexGrow : 1 ,
13
- flexPositive : 1 ,
14
- flexShrink : 1 ,
15
- flexNegative : 1 ,
16
- flexOrder : 1 ,
17
- gridRow : 1 ,
18
- gridRowEnd : 1 ,
19
- gridRowSpan : 1 ,
20
- gridRowStart : 1 ,
21
- gridColumn : 1 ,
22
- gridColumnEnd : 1 ,
23
- gridColumnSpan : 1 ,
24
- gridColumnStart : 1 ,
25
- msGridRow : 1 ,
26
- msGridRowSpan : 1 ,
27
- msGridColumn : 1 ,
28
- msGridColumnSpan : 1 ,
29
- fontWeight : 1 ,
30
- lineHeight : 1 ,
31
- opacity : 1 ,
32
- order : 1 ,
33
- orphans : 1 ,
34
- tabSize : 1 ,
35
- widows : 1 ,
36
- zIndex : 1 ,
37
- zoom : 1 ,
38
- WebkitLineClamp : 1 ,
1
+ const unitlessNames = new Set ( [
2
+ " animationIterationCount" ,
3
+ " borderImageOutset" ,
4
+ " borderImageSlice" ,
5
+ " borderImageWidth" ,
6
+ " boxFlex" ,
7
+ " boxFlexGroup" ,
8
+ " boxOrdinalGroup" ,
9
+ " columnCount" ,
10
+ " columns" ,
11
+ " flex" ,
12
+ " flexGrow" ,
13
+ " flexPositive" ,
14
+ " flexShrink" ,
15
+ " flexNegative" ,
16
+ " flexOrder" ,
17
+ " gridRow" ,
18
+ " gridRowEnd" ,
19
+ " gridRowSpan" ,
20
+ " gridRowStart" ,
21
+ " gridColumn" ,
22
+ " gridColumnEnd" ,
23
+ " gridColumnSpan" ,
24
+ " gridColumnStart" ,
25
+ " msGridRow" ,
26
+ " msGridRowSpan" ,
27
+ " msGridColumn" ,
28
+ " msGridColumnSpan" ,
29
+ " fontWeight" ,
30
+ " lineHeight" ,
31
+ " opacity" ,
32
+ " order" ,
33
+ " orphans" ,
34
+ " tabSize" ,
35
+ " widows" ,
36
+ " zIndex" ,
37
+ " zoom" ,
38
+ " WebkitLineClamp" ,
39
39
40
40
// SVG-related properties
41
- fillOpacity : 1 ,
42
- floodOpacity : 1 ,
43
- stopOpacity : 1 ,
44
- strokeDasharray : 1 ,
45
- strokeDashoffset : 1 ,
46
- strokeMiterlimit : 1 ,
47
- strokeOpacity : 1 ,
48
- strokeWidth : 1
49
- } ;
41
+ " fillOpacity" ,
42
+ " floodOpacity" ,
43
+ " stopOpacity" ,
44
+ " strokeDasharray" ,
45
+ " strokeDashoffset" ,
46
+ " strokeMiterlimit" ,
47
+ " strokeOpacity" ,
48
+ " strokeWidth"
49
+ ] ) ;
50
50
51
51
// Taken from https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/shared/dangerousStyleValue.js
52
52
export const unitize = ( name , value ) => {
53
53
if ( value == null || typeof value === "boolean" || value === "" ) {
54
54
return "" ;
55
55
}
56
56
57
- if ( typeof value === "number" && value !== 0 && ! unitlessKeys [ name ] ) {
57
+ if ( typeof value === "number" && value !== 0 && ! unitlessNames . has ( name ) ) {
58
58
return `${ value } px` ; // Presumes implicit 'px' suffix for unitless numbers
59
59
}
60
60
You can’t perform that action at this time.
0 commit comments