File tree Expand file tree Collapse file tree 10 files changed +29
-4
lines changed
react-dom-bindings/src/shared Expand file tree Collapse file tree 10 files changed +29
-4
lines changed Original file line number Diff line number Diff line change 10
10
import {
11
11
enableFilterEmptyStringAttributesDOM ,
12
12
enableCustomElementPropertySupport ,
13
+ enableNewBooleanProps ,
13
14
} from 'shared/ReactFeatureFlags' ;
14
15
import hasOwnProperty from 'shared/hasOwnProperty' ;
15
16
@@ -331,7 +332,7 @@ reservedProps.forEach(name => {
331
332
} ) ;
332
333
333
334
// These are HTML boolean attributes.
334
- [
335
+ const htmlBooleanAttributes = [
335
336
'allowFullScreen' ,
336
337
'async' ,
337
338
// Note: there is a special case that prevents it from being written to the DOM
@@ -346,7 +347,6 @@ reservedProps.forEach(name => {
346
347
'disableRemotePlayback' ,
347
348
'formNoValidate' ,
348
349
'hidden' ,
349
- 'inert' ,
350
350
'loop' ,
351
351
'noModule' ,
352
352
'noValidate' ,
@@ -359,7 +359,13 @@ reservedProps.forEach(name => {
359
359
'seamless' ,
360
360
// Microdata
361
361
'itemScope' ,
362
- ] . forEach ( name => {
362
+ ] ;
363
+
364
+ if ( enableNewBooleanProps ) {
365
+ htmlBooleanAttributes . push ( 'inert' ) ;
366
+ }
367
+
368
+ htmlBooleanAttributes . forEach ( name => {
363
369
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
364
370
properties [ name ] = new PropertyInfoRecord (
365
371
name ,
Original file line number Diff line number Diff line change 4
4
* This source code is licensed under the MIT license found in the
5
5
* LICENSE file in the root directory of this source tree.
6
6
*/
7
+ import { enableNewBooleanProps } from 'shared/ReactFeatureFlags' ;
7
8
8
9
// When adding attributes to the HTML or SVG allowed attribute list, be sure to
9
10
// also add them to this module to ensure casing and incorrect name
@@ -82,7 +83,6 @@ const possibleStandardNames = {
82
83
id : 'id' ,
83
84
imagesizes : 'imageSizes' ,
84
85
imagesrcset : 'imageSrcSet' ,
85
- inert : 'inert' ,
86
86
innerhtml : 'innerHTML' ,
87
87
inputmode : 'inputMode' ,
88
88
integrity : 'integrity' ,
@@ -503,4 +503,8 @@ const possibleStandardNames = {
503
503
zoomandpan : 'zoomAndPan' ,
504
504
} ;
505
505
506
+ if ( enableNewBooleanProps ) {
507
+ possibleStandardNames . inert = 'inert' ;
508
+ }
509
+
506
510
export default possibleStandardNames ;
Original file line number Diff line number Diff line change @@ -183,6 +183,13 @@ export const enableFilterEmptyStringAttributesDOM = false;
183
183
// https://github.com/facebook/react/issues/11347
184
184
export const enableCustomElementPropertySupport = __EXPERIMENTAL__ ;
185
185
186
+ // HTML boolean attributes need a special PropertyInfoRecord.
187
+ // Between support of these attributes in browsers and React supporting them as
188
+ // boolean props library users can use them as `<div someBooleanAttribute="" />`.
189
+ // However, once React considers them as boolean props an empty string will
190
+ // result in false property i.e. break existing usage.
191
+ export const enableNewBooleanProps = __EXPERIMENTAL__ ;
192
+
186
193
// Disables children for <textarea> elements
187
194
export const disableTextareaChildren = false ;
188
195
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ export const enableSyncDefaultUpdates = true;
71
71
export const enableUnifiedSyncLane = false ;
72
72
export const allowConcurrentByDefault = true ;
73
73
export const enableCustomElementPropertySupport = false ;
74
+ export const enableNewBooleanProps = false ;
74
75
75
76
export const consoleManagedByDevToolsDuringStrictMode = false ;
76
77
export const enableServerContext = true ;
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export const enableSyncDefaultUpdates = true;
62
62
export const enableUnifiedSyncLane = false ;
63
63
export const allowConcurrentByDefault = false ;
64
64
export const enableCustomElementPropertySupport = false ;
65
+ export const enableNewBooleanProps = false ;
65
66
66
67
export const consoleManagedByDevToolsDuringStrictMode = false ;
67
68
export const enableServerContext = true ;
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export const enableSyncDefaultUpdates = true;
62
62
export const enableUnifiedSyncLane = __EXPERIMENTAL__ ;
63
63
export const allowConcurrentByDefault = false ;
64
64
export const enableCustomElementPropertySupport = false ;
65
+ export const enableNewBooleanProps = false ;
65
66
66
67
export const consoleManagedByDevToolsDuringStrictMode = false ;
67
68
export const enableServerContext = true ;
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export const enableSyncDefaultUpdates = true;
62
62
export const enableUnifiedSyncLane = false ;
63
63
export const allowConcurrentByDefault = true ;
64
64
export const enableCustomElementPropertySupport = false ;
65
+ export const enableNewBooleanProps = false ;
65
66
66
67
export const consoleManagedByDevToolsDuringStrictMode = false ;
67
68
export const enableServerContext = true ;
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export const enableSyncDefaultUpdates = true;
62
62
export const enableUnifiedSyncLane = __EXPERIMENTAL__ ;
63
63
export const allowConcurrentByDefault = false ;
64
64
export const enableCustomElementPropertySupport = false ;
65
+ export const enableNewBooleanProps = false ;
65
66
66
67
export const consoleManagedByDevToolsDuringStrictMode = false ;
67
68
export const enableServerContext = true ;
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export const enableSyncDefaultUpdates = true;
62
62
export const enableUnifiedSyncLane = __EXPERIMENTAL__ ;
63
63
export const allowConcurrentByDefault = true ;
64
64
export const enableCustomElementPropertySupport = false ;
65
+ export const enableNewBooleanProps = false ;
65
66
66
67
export const consoleManagedByDevToolsDuringStrictMode = false ;
67
68
export const enableServerContext = true ;
Original file line number Diff line number Diff line change @@ -101,9 +101,11 @@ export const enableServerContext = true;
101
101
export const enableUseMutableSource = true ;
102
102
103
103
export const enableCustomElementPropertySupport = __EXPERIMENTAL__ ;
104
+ export const enableNewBooleanProps = __EXPERIMENTAL__ ;
104
105
105
106
export const useModernStrictMode = false ;
106
107
export const enableFizzExternalRuntime = true ;
107
108
109
+
108
110
// Flow magic to verify the exports of this file match the original version.
109
111
( ( ( ( null : any ) : ExportsType ) : FeatureFlagsType ) : ExportsType ) ;
You can’t perform that action at this time.
0 commit comments