@@ -88,7 +88,7 @@ let lastCurrentDocument: ?Document = null;
8888
8989let previousDispatcher = null ;
9090export function prepareToRenderResources ( rootContainer : Container ) {
91- const rootNode = getRootNode ( rootContainer ) ;
91+ const rootNode = getHoistableRoot ( rootContainer ) ;
9292 lastCurrentDocument = getDocumentFromRoot ( rootNode ) ;
9393
9494 previousDispatcher = Dispatcher . current ;
@@ -111,7 +111,7 @@ export type HoistableRoot = Document | ShadowRoot;
111111const preloadPropsMap : Map < string , PreloadProps > = new Map ( ) ;
112112
113113// getRootNode is missing from IE and old jsdom versions
114- function getRootNode ( container : Container ) : HoistableRoot {
114+ export function getHoistableRoot ( container : Container ) : HoistableRoot {
115115 // $FlowFixMe[method-unbinding]
116116 return typeof container . getRootNode === 'function'
117117 ? /* $FlowFixMe[incompatible-return] Flow types this as returning a `Node`,
@@ -122,7 +122,7 @@ function getRootNode(container: Container): HoistableRoot {
122122
123123function getCurrentResourceRoot ( ) : null | HoistableRoot {
124124 const currentContainer = getCurrentRootHostContainer ( ) ;
125- return currentContainer ? getRootNode ( currentContainer ) : null ;
125+ return currentContainer ? getHoistableRoot ( currentContainer ) : null ;
126126}
127127
128128// Preloads are somewhat special. Even if we don't have the Document
@@ -148,11 +148,6 @@ function getDocumentFromRoot(root: HoistableRoot): Document {
148148 return root . ownerDocument || root ;
149149}
150150
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-
156151// --------------------------------------
157152// ReactDOM.Preload
158153// --------------------------------------
0 commit comments