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