From fbf3bc31585f7142b66eb22770fac90aa9a7e2c1 Mon Sep 17 00:00:00 2001 From: Jonny Burger Date: Thu, 16 Feb 2023 11:12:32 +0100 Subject: [PATCH] Add `scale` as a unitless property (#25601) ## Summary CSS has a new property called `scale` (`scale: 2` is a shorthand for `transform: scale(2)`). In vanilla JavaScript, we can do the following: ```js document.querySelector('div').scale = 2; ``` which will make the `
` twice as big. So in JavaScript, it is possible to pass a plain number. However, in React, the following does not work currently: ```js
``` because `scale` is not in the list of unitless properties. This PR adds `scale` to the list. ## How did you test this change? I built `react` and `react-dom` from source and copied it into the node_modules of my project and verified that now `
` does indeed work whereas before it did not. --- packages/react-dom-bindings/src/shared/CSSProperty.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-dom-bindings/src/shared/CSSProperty.js b/packages/react-dom-bindings/src/shared/CSSProperty.js index 158c533cbbe62..5952aca573fa1 100644 --- a/packages/react-dom-bindings/src/shared/CSSProperty.js +++ b/packages/react-dom-bindings/src/shared/CSSProperty.js @@ -40,6 +40,7 @@ export const isUnitlessNumber = { opacity: true, order: true, orphans: true, + scale: true, tabSize: true, widows: true, zIndex: true,