@@ -88,7 +88,7 @@ let lastCurrentDocument: ?Document = null;
88
88
89
89
let previousDispatcher = null ;
90
90
export function prepareToRenderResources ( rootContainer : Container ) {
91
- const rootNode = getRootNode ( rootContainer ) ;
91
+ const rootNode = getHoistableRoot ( rootContainer ) ;
92
92
lastCurrentDocument = getDocumentFromRoot ( rootNode ) ;
93
93
94
94
previousDispatcher = Dispatcher . current ;
@@ -111,7 +111,7 @@ export type HoistableRoot = Document | ShadowRoot;
111
111
const preloadPropsMap : Map < string , PreloadProps > = new Map ( ) ;
112
112
113
113
// getRootNode is missing from IE and old jsdom versions
114
- function getRootNode ( container : Container ) : HoistableRoot {
114
+ export function getHoistableRoot ( container : Container ) : HoistableRoot {
115
115
// $FlowFixMe[method-unbinding]
116
116
return typeof container . getRootNode === 'function'
117
117
? /* $FlowFixMe[incompatible-return] Flow types this as returning a `Node`,
@@ -122,7 +122,7 @@ function getRootNode(container: Container): HoistableRoot {
122
122
123
123
function getCurrentResourceRoot ( ) : null | HoistableRoot {
124
124
const currentContainer = getCurrentRootHostContainer ( ) ;
125
- return currentContainer ? getRootNode ( currentContainer ) : null ;
125
+ return currentContainer ? getHoistableRoot ( currentContainer ) : null ;
126
126
}
127
127
128
128
// Preloads are somewhat special. Even if we don't have the Document
@@ -148,11 +148,6 @@ function getDocumentFromRoot(root: HoistableRoot): Document {
148
148
return root . ownerDocument || root ;
149
149
}
150
150
151
- export function getHoistableRoot ( container : Container ) : HoistableRoot {
152
- // Flow thinks getRootNode returns Node but we know it is actualy either a Document or ShadowRoot
153
- return ( ( container . getRootNode ( ) : any ) : Document | ShadowRoot ) ;
154
- }
155
-
156
151
// --------------------------------------
157
152
// ReactDOM.Preload
158
153
// --------------------------------------
0 commit comments