Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions packages/react-dom-bindings/src/client/ReactDOMFloatClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ let lastCurrentDocument: ?Document = null;

let previousDispatcher = null;
export function prepareToRenderResources(rootContainer: Container) {
const rootNode = getRootNode(rootContainer);
const rootNode = getHoistableRoot(rootContainer);
lastCurrentDocument = getDocumentFromRoot(rootNode);

previousDispatcher = Dispatcher.current;
Expand All @@ -111,7 +111,7 @@ export type HoistableRoot = Document | ShadowRoot;
const preloadPropsMap: Map<string, PreloadProps> = new Map();

// getRootNode is missing from IE and old jsdom versions
function getRootNode(container: Container): HoistableRoot {
export function getHoistableRoot(container: Container): HoistableRoot {
// $FlowFixMe[method-unbinding]
return typeof container.getRootNode === 'function'
? /* $FlowFixMe[incompatible-return] Flow types this as returning a `Node`,
Expand All @@ -122,7 +122,7 @@ function getRootNode(container: Container): HoistableRoot {

function getCurrentResourceRoot(): null | HoistableRoot {
const currentContainer = getCurrentRootHostContainer();
return currentContainer ? getRootNode(currentContainer) : null;
return currentContainer ? getHoistableRoot(currentContainer) : null;
}

// Preloads are somewhat special. Even if we don't have the Document
Expand All @@ -148,11 +148,6 @@ function getDocumentFromRoot(root: HoistableRoot): Document {
return root.ownerDocument || root;
}

export function getHoistableRoot(container: Container): HoistableRoot {
// Flow thinks getRootNode returns Node but we know it is actualy either a Document or ShadowRoot
return ((container.getRootNode(): any): Document | ShadowRoot);
}

// --------------------------------------
// ReactDOM.Preload
// --------------------------------------
Expand Down