Skip to content

Commit 64acd39

Browse files
authored
remove unguarded getRootNode call (#26152)
I forgot to guard the `getRootNode` call in #26106 and it fails in IE8 and old jsdom. I consolidated the implementation a bit and removed the unguarded call
1 parent 2de85d7 commit 64acd39

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

‎packages/react-dom-bindings/src/client/ReactDOMFloatClient.js‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ let lastCurrentDocument: ?Document = null;
8888

8989
letpreviousDispatcher=null;
9090
exportfunctionprepareToRenderResources(rootContainer: Container){
91-
constrootNode=getRootNode(rootContainer);
91+
constrootNode=getHoistableRoot(rootContainer);
9292
lastCurrentDocument=getDocumentFromRoot(rootNode);
9393

9494
previousDispatcher=Dispatcher.current;
@@ -111,7 +111,7 @@ export type HoistableRoot = Document | ShadowRoot;
111111
constpreloadPropsMap: Map<string,PreloadProps>=newMap();
112112

113113
// getRootNode is missing from IE and old jsdom versions
114-
functiongetRootNode(container: Container): HoistableRoot{
114+
exportfunctiongetHoistableRoot(container: Container): HoistableRoot{
115115
// $FlowFixMe[method-unbinding]
116116
returntypeofcontainer.getRootNode==='function'
117117
? /* $FlowFixMe[incompatible-return] Flow types this as returning a `Node`,
@@ -122,7 +122,7 @@ function getRootNode(container: Container): HoistableRoot {
122122

123123
functiongetCurrentResourceRoot(): null|HoistableRoot{
124124
constcurrentContainer=getCurrentRootHostContainer();
125-
returncurrentContainer ? getRootNode(currentContainer) : null;
125+
returncurrentContainer ? 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
returnroot.ownerDocument||root;
149149
}
150150

151-
exportfunctiongetHoistableRoot(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

Comments
 (0)