dillon1000/react

Commit

[DOM] Fix Fragment dispatchEvent when the container is a Document (#37165)

dispatchEvent appends a temporary Text node to the fragment's nearest
host parent, but a Document can't contain Text, so createRoot(document)
threw HierarchyRequestError whenever the fragment had a listener or the
event didn't bubble.

Use a Comment node for Document containers: it is a legal document child
and sits at the fragment's own position, unlike documentElement, which
would put the target inside the fragment and fire its listeners twice.
Browse files
Changed paths2 files
First-parent comparison
M packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js ModifiedM packages/react-dom/src/__tests__/ReactDOMFragmentRefsDocument-test.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…