From 6682068641c16df6547b3fcdb7877e71bb0bebf9 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Fri, 23 Oct 2020 22:59:13 +0100 Subject: [PATCH] Tweak event delegation notes --- content/docs/testing-recipes.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/docs/testing-recipes.md b/content/docs/testing-recipes.md index 298b867a..87552259 100644 --- a/content/docs/testing-recipes.md +++ b/content/docs/testing-recipes.md @@ -377,7 +377,6 @@ let container = null; beforeEach(() => { // setup a DOM element as a render target container = document.createElement("div"); - // container *must* be attached to document so events work correctly. document.body.appendChild(container); }); @@ -416,7 +415,7 @@ it("changes value when clicked", () => { }); ``` -Different DOM events and their properties are described in [MDN](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent). Note that you need to pass `{ bubbles: true }` in each event you create for it to reach the React listener because React automatically delegates events to the document. +Different DOM events and their properties are described in [MDN](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent). Note that you need to pass `{ bubbles: true }` in each event you create for it to reach the React listener because React automatically delegates events to the root. > Note: >