Skip to content

Commit

Permalink
Check if window exists
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Nov 22, 2024
1 parent f382484 commit 48ff9b8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,12 @@ export function commitTextUpdate(
textInstance.nodeValue = newText;
}

const supportsMoveBefore =
// $FlowFixMe[prop-missing]: We're doing the feature detection here.
enableMoveBefore &&
typeof window !== 'undefined' &&
typeof window.Node.prototype.moveBefore === 'function';

export function appendChild(
parentInstance: Instance,
child: Instance | TextInstance,
Expand Down Expand Up @@ -801,10 +807,6 @@ export function appendChildToContainer(
}
}

const supportsMoveBefore =
// $FlowFixMe[prop-missing]: We're doing the feature detection here.
enableMoveBefore && typeof Node.prototype.moveBefore === 'function';

export function insertBefore(
parentInstance: Instance,
child: Instance | TextInstance,
Expand Down

0 comments on commit 48ff9b8

Please sign in to comment.