File tree 2 files changed +16
-26
lines changed
packages/react-dom-bindings/src
2 files changed +16
-26
lines changed Original file line number Diff line number Diff line change @@ -681,7 +681,7 @@ function setProp(
681
681
}
682
682
}
683
683
}
684
- // fallthrough for new boolean props without the flag on
684
+ // Fallthrough for boolean props that don't have a warning for empty strings.
685
685
case 'allowFullScreen' :
686
686
case 'async' :
687
687
case 'autoPlay' :
@@ -2783,7 +2783,6 @@ function diffHydratedGenericElement(
2783
2783
serverDifferences ,
2784
2784
) ;
2785
2785
continue ;
2786
- // fallthrough for new boolean props without the flag on
2787
2786
default : {
2788
2787
if (
2789
2788
// shouldIgnoreAttribute
Original file line number Diff line number Diff line change @@ -1301,6 +1301,21 @@ function pushAttribute(
1301
1301
}
1302
1302
return ;
1303
1303
}
1304
+ case 'inert ': {
1305
+ if ( __DEV__ ) {
1306
+ if ( value === '' && ! didWarnForNewBooleanPropsWithEmptyValue [ name ] ) {
1307
+ didWarnForNewBooleanPropsWithEmptyValue [ name ] = true ;
1308
+ console . error (
1309
+ 'Received an empty string for a boolean attribute `%s`. ' +
1310
+ 'This will treat the attribute as if it were false. ' +
1311
+ 'Either pass `false` to silence this warning, or ' +
1312
+ 'pass `true` if you used an empty string in earlier versions of React to indicate this attribute is true.' ,
1313
+ name ,
1314
+ ) ;
1315
+ }
1316
+ }
1317
+ }
1318
+ // Fallthrough for boolean props that don't have a warning for empty strings.
1304
1319
case 'allowFullScreen' :
1305
1320
case 'async ':
1306
1321
case 'autoPlay ':
@@ -1421,30 +1436,6 @@ function pushAttribute(
1421
1436
case 'xmlSpace ':
1422
1437
pushStringAttribute ( target , 'xml:space' , value ) ;
1423
1438
return ;
1424
- case 'inert ': {
1425
- if ( __DEV__ ) {
1426
- if ( value === '' && ! didWarnForNewBooleanPropsWithEmptyValue [ name ] ) {
1427
- didWarnForNewBooleanPropsWithEmptyValue [ name ] = true ;
1428
- console . error (
1429
- 'Received an empty string for a boolean attribute `%s`. ' +
1430
- 'This will treat the attribute as if it were false. ' +
1431
- 'Either pass `false` to silence this warning, or ' +
1432
- 'pass `true` if you used an empty string in earlier versions of React to indicate this attribute is true.' ,
1433
- name ,
1434
- ) ;
1435
- }
1436
- }
1437
- // Boolean
1438
- if ( value && typeof value !== 'function' && typeof value !== 'symbol' ) {
1439
- target . push (
1440
- attributeSeparator ,
1441
- stringToChunk ( name ) ,
1442
- attributeEmptyString ,
1443
- ) ;
1444
- }
1445
- return ;
1446
- }
1447
- // fallthrough for new boolean props without the flag on
1448
1439
default :
1449
1440
if (
1450
1441
// shouldIgnoreAttribute
You can’t perform that action at this time.
0 commit comments