Files
react/packages/react-dom-bindings/src/shared/isUnitlessNumber.js
T
Sophie Alpert 19c7c2929b Revert "Remove zoom from special cases list" (#28673)
Reverts facebook/react#26631

This got specced: https://github.com/w3c/csswg-drafts/pull/9699

I left msZoom because it seems plausible someone will still be using it
for backwards compat.
2024-03-29 10:39:12 -07:00

89 lines
1.8 KiB
JavaScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
/**
* CSS properties which accept numbers but are not in units of "px".
*/
const unitlessNumbers = new Set([
'animationIterationCount',
'aspectRatio',
'borderImageOutset',
'borderImageSlice',
'borderImageWidth',
'boxFlex',
'boxFlexGroup',
'boxOrdinalGroup',
'columnCount',
'columns',
'flex',
'flexGrow',
'flexPositive',
'flexShrink',
'flexNegative',
'flexOrder',
'gridArea',
'gridRow',
'gridRowEnd',
'gridRowSpan',
'gridRowStart',
'gridColumn',
'gridColumnEnd',
'gridColumnSpan',
'gridColumnStart',
'fontWeight',
'lineClamp',
'lineHeight',
'opacity',
'order',
'orphans',
'scale',
'tabSize',
'widows',
'zIndex',
'zoom',
'fillOpacity', // SVG-related properties
'floodOpacity',
'stopOpacity',
'strokeDasharray',
'strokeDashoffset',
'strokeMiterlimit',
'strokeOpacity',
'strokeWidth',
'MozAnimationIterationCount', // Known Prefixed Properties
'MozBoxFlex', // TODO: Remove these since they shouldn't be used in modern code
'MozBoxFlexGroup',
'MozLineClamp',
'msAnimationIterationCount',
'msFlex',
'msZoom',
'msFlexGrow',
'msFlexNegative',
'msFlexOrder',
'msFlexPositive',
'msFlexShrink',
'msGridColumn',
'msGridColumnSpan',
'msGridRow',
'msGridRowSpan',
'WebkitAnimationIterationCount',
'WebkitBoxFlex',
'WebKitBoxFlexGroup',
'WebkitBoxOrdinalGroup',
'WebkitColumnCount',
'WebkitColumns',
'WebkitFlex',
'WebkitFlexGrow',
'WebkitFlexPositive',
'WebkitFlexShrink',
'WebkitLineClamp',
]);
export default function (name: string): boolean {
return unitlessNumbers.has(name);
}