Skip to content

Commit b964e2e

Browse files
committed
Refactor DOMProperty and CSSProperty (#26513)
This is a step towards getting rid of the meta programming in DOMProperty and CSSProperty. This moves isAttributeNameSafe and isUnitlessNumber to a separate shared modules. isUnitlessNumber is now a single switch instead of meta-programming. There is a slight behavior change here in that I hard code a specific set of vendor-prefixed attributes instead of prefixing all the unitless properties. I based this list on what getComputedStyle returns in current browsers. I removed Opera prefixes because they were [removed in Opera](https://dev.opera.com/blog/css-vendor-prefixes-in-opera-12-50-snapshots/) itself. I included the ms ones mentioned [in the original PR](5abcce5). These shouldn't really be used anymore anyway so should be pretty safe. Worst case, they'll fallback to the other property if you specify both. Finally I inline the mustUseProperty special cases - which are also the only thing that uses propertyName. These are really all controlled components and all booleans. I'm making a small breaking change here by treating `checked` and `selected` specially only on the `input` and `option` tags instead of all tags. That's because those are the only DOM nodes that actually have those properties but we used to set them as expandos instead of attributes before. That's why one of the tests is updated to now use `input` instead of testing an expando on a `div` which isn't a real use case. Interestingly this also uncovered that we update checked twice for some reason but keeping that logic for now. Ideally `multiple` and `muted` should move into `select` and `audio`/`video` respectively for the same reason. No change to the attribute-behavior fixture. DiffTrain build for [73deff0](73deff0)
1 parent b0ce267 commit b964e2e

25 files changed

+4630
-4724
lines changed

compiled/facebook-www/REVISION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2d51251e608b7b1a8baf79ae6bdba81ed8e1939a
1+
73deff0d5162160c0aafa5cd0b87e11143fe9938

compiled/facebook-www/React-dev.modern.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

30-
var ReactVersion = "18.3.0-www-modern-8f791852";
30+
var ReactVersion = "18.3.0-www-modern-8f5a57f2";
3131

3232
// ATTENTION
3333
// When adding new symbols to this file,

compiled/facebook-www/ReactART-dev.classic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
6969
return self;
7070
}
7171

72-
var ReactVersion = "18.3.0-www-classic-4dc1bcfd";
72+
var ReactVersion = "18.3.0-www-classic-26d7a5d5";
7373

7474
var LegacyRoot = 0;
7575
var ConcurrentRoot = 1;

compiled/facebook-www/ReactART-prod.modern.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9688,7 +9688,7 @@ var slice = Array.prototype.slice,
96889688
return null;
96899689
},
96909690
bundleType: 0,
9691-
version: "18.3.0-www-modern-af295806",
9691+
version: "18.3.0-www-modern-6ef7b87a",
96929692
rendererPackageName: "react-art"
96939693
};
96949694
var internals$jscomp$inline_1304 = {
@@ -9719,7 +9719,7 @@ var internals$jscomp$inline_1304 = {
97199719
scheduleRoot: null,
97209720
setRefreshHandler: null,
97219721
getCurrentFiber: null,
9722-
reconcilerVersion: "18.3.0-www-modern-af295806"
9722+
reconcilerVersion: "18.3.0-www-modern-6ef7b87a"
97239723
};
97249724
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
97259725
var hook$jscomp$inline_1305 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

0 commit comments

Comments
 (0)