File tree Expand file tree Collapse file tree 10 files changed +28
-4
lines changed
react-dom-bindings/src/shared Expand file tree Collapse file tree 10 files changed +28
-4
lines changed Original file line number Diff line number Diff line change 1010import {
1111 enableFilterEmptyStringAttributesDOM ,
1212 enableCustomElementPropertySupport ,
13+ enableNewBooleanProps ,
1314} from 'shared/ReactFeatureFlags' ;
1415import hasOwnProperty from 'shared/hasOwnProperty' ;
1516
@@ -331,7 +332,7 @@ reservedProps.forEach(name => {
331332} ) ;
332333
333334// These are HTML boolean attributes.
334- [
335+ const htmlBooleanAttributes = [
335336 'allowFullScreen' ,
336337 'async' ,
337338 // Note: there is a special case that prevents it from being written to the DOM
@@ -346,7 +347,6 @@ reservedProps.forEach(name => {
346347 'disableRemotePlayback' ,
347348 'formNoValidate' ,
348349 'hidden' ,
349- 'inert' ,
350350 'loop' ,
351351 'noModule' ,
352352 'noValidate' ,
@@ -359,7 +359,13 @@ reservedProps.forEach(name => {
359359 'seamless' ,
360360 // Microdata
361361 'itemScope' ,
362- ] . forEach ( name => {
362+ ] ;
363+
364+ if ( enableNewBooleanProps ) {
365+ htmlBooleanAttributes . push ( 'inert' ) ;
366+ }
367+
368+ htmlBooleanAttributes . forEach ( name => {
363369 // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
364370 properties [ name ] = new PropertyInfoRecord (
365371 name ,
Original file line number Diff line number Diff line change 44 * This source code is licensed under the MIT license found in the
55 * LICENSE file in the root directory of this source tree.
66 */
7+ import { enableNewBooleanProps } from 'shared/ReactFeatureFlags' ;
78
89// When adding attributes to the HTML or SVG allowed attribute list, be sure to
910// also add them to this module to ensure casing and incorrect name
@@ -82,7 +83,6 @@ const possibleStandardNames = {
8283 id : 'id' ,
8384 imagesizes : 'imageSizes' ,
8485 imagesrcset : 'imageSrcSet' ,
85- inert : 'inert' ,
8686 innerhtml : 'innerHTML' ,
8787 inputmode : 'inputMode' ,
8888 integrity : 'integrity' ,
@@ -503,4 +503,8 @@ const possibleStandardNames = {
503503 zoomandpan : 'zoomAndPan' ,
504504} ;
505505
506+ if ( enableNewBooleanProps ) {
507+ possibleStandardNames . inert = 'inert' ;
508+ }
509+
506510export default possibleStandardNames ;
Original file line number Diff line number Diff line change @@ -183,6 +183,13 @@ export const enableFilterEmptyStringAttributesDOM = false;
183183// https://github.com/facebook/react/issues/11347
184184export const enableCustomElementPropertySupport = __EXPERIMENTAL__ ;
185185
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+
186193// Disables children for <textarea> elements
187194export const disableTextareaChildren = false ;
188195
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ export const enableSyncDefaultUpdates = true;
7171export const enableUnifiedSyncLane = false ;
7272export const allowConcurrentByDefault = true ;
7373export const enableCustomElementPropertySupport = false ;
74+ export const enableNewBooleanProps = false ;
7475
7576export const consoleManagedByDevToolsDuringStrictMode = false ;
7677export const enableServerContext = true ;
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export const enableSyncDefaultUpdates = true;
6262export const enableUnifiedSyncLane = false ;
6363export const allowConcurrentByDefault = false ;
6464export const enableCustomElementPropertySupport = false ;
65+ export const enableNewBooleanProps = false ;
6566
6667export const consoleManagedByDevToolsDuringStrictMode = false ;
6768export const enableServerContext = true ;
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export const enableSyncDefaultUpdates = true;
6262export const enableUnifiedSyncLane = __EXPERIMENTAL__ ;
6363export const allowConcurrentByDefault = false ;
6464export const enableCustomElementPropertySupport = false ;
65+ export const enableNewBooleanProps = false ;
6566
6667export const consoleManagedByDevToolsDuringStrictMode = false ;
6768export const enableServerContext = true ;
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export const enableSyncDefaultUpdates = true;
6262export const enableUnifiedSyncLane = false ;
6363export const allowConcurrentByDefault = true ;
6464export const enableCustomElementPropertySupport = false ;
65+ export const enableNewBooleanProps = false ;
6566
6667export const consoleManagedByDevToolsDuringStrictMode = false ;
6768export const enableServerContext = true ;
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export const enableSyncDefaultUpdates = true;
6262export const enableUnifiedSyncLane = __EXPERIMENTAL__ ;
6363export const allowConcurrentByDefault = false ;
6464export const enableCustomElementPropertySupport = false ;
65+ export const enableNewBooleanProps = false ;
6566
6667export const consoleManagedByDevToolsDuringStrictMode = false ;
6768export const enableServerContext = true ;
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export const enableSyncDefaultUpdates = true;
6262export const enableUnifiedSyncLane = __EXPERIMENTAL__ ;
6363export const allowConcurrentByDefault = true ;
6464export const enableCustomElementPropertySupport = false ;
65+ export const enableNewBooleanProps = false ;
6566
6667export const consoleManagedByDevToolsDuringStrictMode = false ;
6768export const enableServerContext = true ;
Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ export const enableServerContext = true;
101101export const enableUseMutableSource = true ;
102102
103103export const enableCustomElementPropertySupport = __EXPERIMENTAL__ ;
104+ export const enableNewBooleanProps = __EXPERIMENTAL__ ;
104105
105106export const useModernStrictMode = false ;
106107export const enableFizzExternalRuntime = true ;
You can’t perform that action at this time.
0 commit comments