File tree 3 files changed +11
-5
lines changed
packages/react-dom-bindings/src/client 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 7
7
* @flow
8
8
*/
9
9
10
- import type { Instance , Container , HostContextDev } from './ReactDOMHostConfig' ;
10
+ import type { Instance , Container } from './ReactDOMHostConfig' ;
11
11
12
12
import ReactDOMSharedInternals from 'shared/ReactDOMSharedInternals.js' ;
13
13
const { Dispatcher} = ReactDOMSharedInternals ;
@@ -33,6 +33,7 @@ import {
33
33
getCurrentRootHostContainer ,
34
34
getHostContext ,
35
35
} from 'react-reconciler/src/ReactFiberHostContext' ;
36
+ import { getResourceFormOnly } from './validateDOMNesting' ;
36
37
37
38
// The resource types we support. currently they match the form for the as argument.
38
39
// In the future this may need to change, especially when modules / scripts are supported
@@ -1336,8 +1337,8 @@ function insertResourceInstanceBefore(
1336
1337
export function isHostResourceType ( type : string , props : Props ) : boolean {
1337
1338
let resourceFormOnly : boolean ;
1338
1339
if ( __DEV__ ) {
1339
- const hostContextDev : HostContextDev = ( getHostContext ( ) : any ) ;
1340
- resourceFormOnly = ( hostContextDev . ancestorInfo : any ) . resourceFormOnly ;
1340
+ const hostContext = getHostContext ( ) ;
1341
+ resourceFormOnly = getResourceFormOnly ( hostContext ) ;
1341
1342
}
1342
1343
switch ( type ) {
1343
1344
case 'meta':
Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ export interface SuspenseInstance extends Comment {
133
133
}
134
134
export type HydratableInstance = Instance | TextInstance | SuspenseInstance ;
135
135
export type PublicInstance = Element | Text ;
136
- export type HostContextDev = {
136
+ type HostContextDev = {
137
137
namespace : string ,
138
138
ancestorInfo : mixed ,
139
139
...
Original file line number Diff line number Diff line change 7
7
8
8
let validateDOMNesting = ( ) => { } ;
9
9
let updatedAncestorInfo = ( ) => { } ;
10
+ let getResourceFormOnly = ( ) => false ;
10
11
11
12
if ( __DEV__ ) {
12
13
// This validation code was written based on the HTML5 parsing spec:
@@ -478,6 +479,10 @@ if (__DEV__) {
478
479
) ;
479
480
}
480
481
} ;
482
+
483
+ getResourceFormOnly = hostContextDev => {
484
+ return hostContextDev . ancestorInfo . resourceFormOnly ;
485
+ } ;
481
486
}
482
487
483
- export { updatedAncestorInfo , validateDOMNesting } ;
488
+ export { updatedAncestorInfo , validateDOMNesting , getResourceFormOnly } ;
You can’t perform that action at this time.
0 commit comments