Skip to content

Commit

Permalink
Tweak event delegation notes
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored Oct 23, 2020
1 parent 16a03c0 commit 6682068
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions content/docs/testing-recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down Expand Up @@ -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:
>
Expand Down

0 comments on commit 6682068

Please sign in to comment.