@@ -63,10 +63,7 @@ import {validateProperties as validateInputProperties} from '../shared/ReactDOMN
63
63
import { validateProperties as validateUnknownProperties } from '../shared/ReactDOMUnknownPropertyHook' ;
64
64
import sanitizeURL from '../shared/sanitizeURL' ;
65
65
66
- import {
67
- enableTrustedTypesIntegration ,
68
- enableFilterEmptyStringAttributesDOM ,
69
- } from 'shared/ReactFeatureFlags' ;
66
+ import { enableTrustedTypesIntegration } from 'shared/ReactFeatureFlags' ;
70
67
import {
71
68
mediaEventTypes ,
72
69
listenToNonDelegatedEvent ,
@@ -400,35 +397,33 @@ function setProp(
400
397
// fallthrough
401
398
case 'src' :
402
399
case 'href' : {
403
- if ( enableFilterEmptyStringAttributesDOM ) {
404
- if (
405
- value === '' &&
406
- // <a href=""> is fine for "reload" links.
407
- ! ( tag === 'a' && key === 'href' )
408
- ) {
409
- if ( __DEV__ ) {
410
- if ( key === 'src' ) {
411
- console . error (
412
- 'An empty string ("") was passed to the %s attribute. ' +
413
- 'This may cause the browser to download the whole page again over the network. ' +
414
- 'To fix this, either do not render the element at all ' +
415
- 'or pass null to %s instead of an empty string.' ,
416
- key ,
417
- key ,
418
- ) ;
419
- } else {
420
- console . error (
421
- 'An empty string ("") was passed to the %s attribute. ' +
422
- 'To fix this, either do not render the element at all ' +
423
- 'or pass null to %s instead of an empty string.' ,
424
- key ,
425
- key ,
426
- ) ;
427
- }
400
+ if (
401
+ value === '' &&
402
+ // <a href=""> is fine for "reload" links.
403
+ ! ( tag === 'a' && key === 'href' )
404
+ ) {
405
+ if ( __DEV__ ) {
406
+ if ( key === 'src' ) {
407
+ console . error (
408
+ 'An empty string ("") was passed to the %s attribute. ' +
409
+ 'This may cause the browser to download the whole page again over the network. ' +
410
+ 'To fix this, either do not render the element at all ' +
411
+ 'or pass null to %s instead of an empty string.' ,
412
+ key ,
413
+ key ,
414
+ ) ;
415
+ } else {
416
+ console . error (
417
+ 'An empty string ("") was passed to the %s attribute. ' +
418
+ 'To fix this, either do not render the element at all ' +
419
+ 'or pass null to %s instead of an empty string.' ,
420
+ key ,
421
+ key ,
422
+ ) ;
428
423
}
429
- domElement . removeAttribute ( key ) ;
430
- break ;
431
424
}
425
+ domElement . removeAttribute ( key ) ;
426
+ break ;
432
427
}
433
428
if (
434
429
value == null ||
@@ -2489,53 +2484,52 @@ function diffHydratedGenericElement(
2489
2484
// fallthrough
2490
2485
case 'src' :
2491
2486
case 'href' :
2492
- if ( enableFilterEmptyStringAttributesDOM ) {
2493
- if (
2494
- value === '' &&
2495
- // <a href=""> is fine for "reload" links.
2496
- ! ( tag === 'a' && propKey === 'href' ) &&
2497
- ! ( tag === 'object' && propKey === 'data' )
2498
- ) {
2499
- if ( __DEV__ ) {
2500
- if ( propKey === 'src' ) {
2501
- console . error (
2502
- 'An empty string ("") was passed to the %s attribute. ' +
2503
- 'This may cause the browser to download the whole page again over the network. ' +
2504
- 'To fix this, either do not render the element at all ' +
2505
- 'or pass null to %s instead of an empty string.' ,
2506
- propKey ,
2507
- propKey ,
2508
- ) ;
2509
- } else {
2510
- console . error (
2511
- 'An empty string ("") was passed to the %s attribute. ' +
2512
- 'To fix this, either do not render the element at all ' +
2513
- 'or pass null to %s instead of an empty string.' ,
2514
- propKey ,
2515
- propKey ,
2516
- ) ;
2517
- }
2487
+ if (
2488
+ value === '' &&
2489
+ // <a href=""> is fine for "reload" links.
2490
+ ! ( tag === 'a' && propKey === 'href' ) &&
2491
+ ! ( tag === 'object' && propKey === 'data' )
2492
+ ) {
2493
+ if ( __DEV__ ) {
2494
+ if ( propKey === 'src' ) {
2495
+ console . error (
2496
+ 'An empty string ("") was passed to the %s attribute. ' +
2497
+ 'This may cause the browser to download the whole page again over the network. ' +
2498
+ 'To fix this, either do not render the element at all ' +
2499
+ 'or pass null to %s instead of an empty string.' ,
2500
+ propKey ,
2501
+ propKey ,
2502
+ ) ;
2503
+ } else {
2504
+ console . error (
2505
+ 'An empty string ("") was passed to the %s attribute. ' +
2506
+ 'To fix this, either do not render the element at all ' +
2507
+ 'or pass null to %s instead of an empty string.' ,
2508
+ propKey ,
2509
+ propKey ,
2510
+ ) ;
2518
2511
}
2519
- hydrateSanitizedAttribute (
2520
- domElement ,
2521
- propKey ,
2522
- propKey ,
2523
- null ,
2524
- extraAttributes ,
2525
- serverDifferences ,
2526
- ) ;
2527
- continue ;
2528
2512
}
2513
+ hydrateSanitizedAttribute (
2514
+ domElement ,
2515
+ propKey ,
2516
+ propKey ,
2517
+ null ,
2518
+ extraAttributes ,
2519
+ serverDifferences ,
2520
+ ) ;
2521
+ continue ;
2522
+ } else {
2523
+ hydrateSanitizedAttribute (
2524
+ domElement ,
2525
+ propKey ,
2526
+ propKey ,
2527
+ value ,
2528
+ extraAttributes ,
2529
+ serverDifferences ,
2530
+ ) ;
2531
+ continue ;
2529
2532
}
2530
- hydrateSanitizedAttribute (
2531
- domElement ,
2532
- propKey ,
2533
- propKey ,
2534
- value ,
2535
- extraAttributes ,
2536
- serverDifferences ,
2537
- ) ;
2538
- continue ;
2539
2533
case 'action' :
2540
2534
case 'formAction' : {
2541
2535
const serverValue = domElement . getAttribute ( propKey ) ;
0 commit comments