Skip to content

Commit

Permalink
Update morphdom example with idiomorph in Handbook
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoroth authored Feb 22, 2024
1 parent f33f804 commit 4ec13be
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions _source/handbook/02_drive.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ Restoration visits cannot be canceled and do not fire `turbo:before-visit`. Turb

Applications can customize the rendering process by adding a document-wide `turbo:before-render` event listener and overriding the `event.detail.render` property.

For example, you could merge the response document's `<body>` element into the requesting document's `<body>` element with [morphdom](https://github.com/patrick-steele-idem/morphdom):
For example, you could merge the response document's `<body>` element into the requesting document's `<body>` element with [idiomorph](https://github.com/bigskysoftware/idiomorph) or [morphdom](https://github.com/patrick-steele-idem/morphdom):

```javascript
import morphdom from "morphdom"
import { Idiomorph } from "idiomorph"

addEventListener("turbo:before-render", (event) => {
event.detail.render = (currentElement, newElement) => {
morphdom(currentElement, newElement)
Idiomorph.morph(currentElement, newElement)
}
})
```
Expand Down

0 comments on commit 4ec13be

Please sign in to comment.