Skip to content

Commit a042057

Browse files
author
Sebastian Silbermann
committed
Revert "Less hacky, more verbose, more runtime impact"
This reverts commit 133867b.
1 parent 6c5b3cc commit a042057

File tree

3 files changed

+27
-46
lines changed

3 files changed

+27
-46
lines changed

packages/react-dom-bindings/src/client/ReactDOMComponent.js

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ function setProp(
712712
case 'disableRemotePlayback':
713713
case 'formNoValidate':
714714
case 'hidden':
715-
case 'inert':
715+
case enableNewBooleanProps ? 'inert' : 'formNoValidate':
716716
case 'loop':
717717
case 'noModule':
718718
case 'noValidate':
@@ -724,18 +724,14 @@ function setProp(
724724
case 'scoped':
725725
case 'seamless':
726726
case 'itemScope': {
727-
const isNewBooleanProp = key === 'inert';
728-
if (enableNewBooleanProps || !isNewBooleanProp) {
729-
if (value && typeof value !== 'function' && typeof value !== 'symbol') {
730-
domElement.setAttribute(key, '');
731-
} else {
732-
domElement.removeAttribute(key);
733-
}
734-
break;
727+
if (value && typeof value !== 'function' && typeof value !== 'symbol') {
728+
domElement.setAttribute(key, '');
729+
} else {
730+
domElement.removeAttribute(key);
735731
}
732+
break;
736733
}
737734
// Overloaded Boolean
738-
// eslint-disable-next-line no-fallthrough -- Re-enable once enableNewBooleanProps is removed.
739735
case 'capture':
740736
case 'download': {
741737
// An attribute that can be used as a flag as well as with a value.
@@ -2491,7 +2487,7 @@ function diffHydratedGenericElement(
24912487
case 'disableRemotePlayback':
24922488
case 'formNoValidate':
24932489
case 'hidden':
2494-
case 'inert':
2490+
case enableNewBooleanProps ? 'inert' : 'formNoValidate':
24952491
case 'loop':
24962492
case 'noModule':
24972493
case 'noValidate':
@@ -2503,20 +2499,16 @@ function diffHydratedGenericElement(
25032499
case 'scoped':
25042500
case 'seamless':
25052501
case 'itemScope': {
2506-
const isNewBooleanProp = propKey === 'inert';
2507-
if (enableNewBooleanProps || !isNewBooleanProp) {
2508-
// Some of these need to be lower case to remove them from the extraAttributes list.
2509-
hydrateBooleanAttribute(
2510-
domElement,
2511-
propKey,
2512-
propKey.toLowerCase(),
2513-
value,
2514-
extraAttributes,
2515-
);
2516-
continue;
2517-
}
2502+
// Some of these need to be lower case to remove them from the extraAttributes list.
2503+
hydrateBooleanAttribute(
2504+
domElement,
2505+
propKey,
2506+
propKey.toLowerCase(),
2507+
value,
2508+
extraAttributes,
2509+
);
2510+
continue;
25182511
}
2519-
// eslint-disable-next-line no-fallthrough -- Re-enable once enableNewBooleanProps is removed.
25202512
case 'capture':
25212513
case 'download': {
25222514
hydrateOverloadedBooleanAttribute(

packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,7 +1295,7 @@ function pushAttribute(
12951295
case 'disableRemotePlayback':
12961296
case 'formNoValidate':
12971297
case 'hidden':
1298-
case 'inert':
1298+
case enableNewBooleanProps ? 'inert' : 'formNoValidate':
12991299
case 'loop':
13001300
case 'noModule':
13011301
case 'noValidate':
@@ -1307,20 +1307,16 @@ function pushAttribute(
13071307
case 'scoped':
13081308
case 'seamless':
13091309
case 'itemScope': {
1310-
const isNewBooleanProp = name === 'inert';
1311-
if (enableNewBooleanProps || !isNewBooleanProp) {
1312-
// Boolean
1313-
if (value && typeof value !== 'function' && typeof value !== 'symbol') {
1314-
target.push(
1315-
attributeSeparator,
1316-
stringToChunk(name),
1317-
attributeEmptyString,
1318-
);
1319-
}
1320-
return;
1310+
// Boolean
1311+
if (value && typeof value !== 'function' && typeof value !== 'symbol') {
1312+
target.push(
1313+
attributeSeparator,
1314+
stringToChunk(name),
1315+
attributeEmptyString,
1316+
);
13211317
}
1318+
return;
13221319
}
1323-
// eslint-disable-next-line no-fallthrough -- Re-enable once enableNewBooleanProps is removed.
13241320
case 'capture':
13251321
case 'download': {
13261322
// Overloaded Boolean

packages/react-dom-bindings/src/shared/ReactDOMUnknownPropertyHook.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ function validateProperty(tagName, name, value, eventRegistry) {
224224
case 'disableRemotePlayback':
225225
case 'formNoValidate':
226226
case 'hidden':
227+
case enableNewBooleanProps ? 'inert' : 'formNoValidate':
227228
case 'loop':
228229
case 'noModule':
229230
case 'noValidate':
@@ -241,10 +242,6 @@ function validateProperty(tagName, name, value, eventRegistry) {
241242
return true;
242243
}
243244
default: {
244-
// TODO: Move into above cases once enableNewBooleanProps is removed.
245-
if (enableNewBooleanProps && name === 'inert') {
246-
return true;
247-
}
248245
const prefix = name.toLowerCase().slice(0, 5);
249246
if (prefix === 'data-' || prefix === 'aria-') {
250247
return true;
@@ -305,6 +302,7 @@ function validateProperty(tagName, name, value, eventRegistry) {
305302
case 'disableRemotePlayback':
306303
case 'formNoValidate':
307304
case 'hidden':
305+
case enableNewBooleanProps ? 'inert' : 'formNoValidate':
308306
case 'loop':
309307
case 'noModule':
310308
case 'noValidate':
@@ -318,11 +316,6 @@ function validateProperty(tagName, name, value, eventRegistry) {
318316
case 'itemScope': {
319317
break;
320318
}
321-
case 'inert':
322-
if (enableNewBooleanProps) {
323-
break;
324-
}
325-
// eslint-disable-next-line no-fallthrough -- not flagged after DCE
326319
default: {
327320
return true;
328321
}

0 commit comments

Comments
 (0)