Skip to content

Commit e2d5e5c

Browse files
committed
Try set again
1 parent 4fa587a commit e2d5e5c

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

src/basic/unitize.js

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
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",
3939

4040
// 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+
]);
5050

5151
// Taken from https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/shared/dangerousStyleValue.js
5252
export const unitize = (name, value) => {
5353
if (value == null || typeof value === "boolean" || value === "") {
5454
return "";
5555
}
5656

57-
if (typeof value === "number" && value !== 0 && !unitlessKeys[name]) {
57+
if (typeof value === "number" && value !== 0 && !unitlessNames.has(name)) {
5858
return `${value}px`; // Presumes implicit 'px' suffix for unitless numbers
5959
}
6060

0 commit comments

Comments
 (0)