Skip to content

Commit

Permalink
Merge pull request hotwired#173 from marcoroth/idiomorph
Browse files Browse the repository at this point in the history
Update `morphdom` example with `idiomorph` in Handbook
  • Loading branch information
brunoprietog authored Jun 21, 2024
2 parents 2230464 + 4ec13be commit c2a19cd
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 c2a19cd

Please sign in to comment.