From e2d5e5c7944b8573cc347729bdee1fa229be1627 Mon Sep 17 00:00:00 2001 From: Lewis Liu Date: Mon, 6 Dec 2021 20:01:33 -0800 Subject: [PATCH] Try set again --- src/basic/unitize.js | 96 ++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/src/basic/unitize.js b/src/basic/unitize.js index b724be4..5b35d2c 100644 --- a/src/basic/unitize.js +++ b/src/basic/unitize.js @@ -1,52 +1,52 @@ -let unitlessKeys = { - animationIterationCount: 1, - borderImageOutset: 1, - borderImageSlice: 1, - borderImageWidth: 1, - boxFlex: 1, - boxFlexGroup: 1, - boxOrdinalGroup: 1, - columnCount: 1, - columns: 1, - flex: 1, - flexGrow: 1, - flexPositive: 1, - flexShrink: 1, - flexNegative: 1, - flexOrder: 1, - gridRow: 1, - gridRowEnd: 1, - gridRowSpan: 1, - gridRowStart: 1, - gridColumn: 1, - gridColumnEnd: 1, - gridColumnSpan: 1, - gridColumnStart: 1, - msGridRow: 1, - msGridRowSpan: 1, - msGridColumn: 1, - msGridColumnSpan: 1, - fontWeight: 1, - lineHeight: 1, - opacity: 1, - order: 1, - orphans: 1, - tabSize: 1, - widows: 1, - zIndex: 1, - zoom: 1, - WebkitLineClamp: 1, +const unitlessNames = new Set([ + "animationIterationCount", + "borderImageOutset", + "borderImageSlice", + "borderImageWidth", + "boxFlex", + "boxFlexGroup", + "boxOrdinalGroup", + "columnCount", + "columns", + "flex", + "flexGrow", + "flexPositive", + "flexShrink", + "flexNegative", + "flexOrder", + "gridRow", + "gridRowEnd", + "gridRowSpan", + "gridRowStart", + "gridColumn", + "gridColumnEnd", + "gridColumnSpan", + "gridColumnStart", + "msGridRow", + "msGridRowSpan", + "msGridColumn", + "msGridColumnSpan", + "fontWeight", + "lineHeight", + "opacity", + "order", + "orphans", + "tabSize", + "widows", + "zIndex", + "zoom", + "WebkitLineClamp", // SVG-related properties - fillOpacity: 1, - floodOpacity: 1, - stopOpacity: 1, - strokeDasharray: 1, - strokeDashoffset: 1, - strokeMiterlimit: 1, - strokeOpacity: 1, - strokeWidth: 1 -}; + "fillOpacity", + "floodOpacity", + "stopOpacity", + "strokeDasharray", + "strokeDashoffset", + "strokeMiterlimit", + "strokeOpacity", + "strokeWidth" +]); // Taken from https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/shared/dangerousStyleValue.js export const unitize = (name, value) => { @@ -54,7 +54,7 @@ export const unitize = (name, value) => { return ""; } - if (typeof value === "number" && value !== 0 && !unitlessKeys[name]) { + if (typeof value === "number" && value !== 0 && !unitlessNames.has(name)) { return `${value}px`; // Presumes implicit 'px' suffix for unitless numbers }