SIGN IN SIGN UP

[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.
J
Jack Pope committed
305feb9058f38363e25c61d69985b9393b16cc2a
Parent: 18c30e7
Committed by GitHub <noreply@github.com> on 8/12/2026, 1:32:39 AM