Skip to content

Commit

Permalink
Merge pull request #184 from swanson/matt/doc-body-updates
Browse files Browse the repository at this point in the history
Clarify swapping of <body> contents, not tag itself
  • Loading branch information
dhh authored Apr 10, 2024
2 parents 2a28ae4 + bf8a2dd commit a54529d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion _source/handbook/01_introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This happens by intercepting all clicks on `<a href>` links to the same domain.

Same deal with forms. Their submissions are turned into `fetch` requests from which Turbo Drive will follow the redirect and render the HTML response.

During rendering, Turbo Drive replaces the current `<body>` element outright and merges the contents of the `<head>` element. The JavaScript window and document objects, and the `<html>` element, persist from one rendering to the next.
During rendering, Turbo Drive replaces the contents of the `<body>` element and merges the contents of the `<head>` element. The JavaScript window and document objects, and the `<html>` element, persist from one rendering to the next.

While it's possible to interact directly with Turbo Drive to control how visits happen or hook into the lifecycle of the request, the majority of the time this is a drop-in replacement where the speed is free just by adopting a few conventions.

Expand Down
2 changes: 1 addition & 1 deletion _source/handbook/03_page_refreshes.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You can configure how Turbo handles page refresh with a `<meta name="turbo-refre
</head>
```

The possible values are `morph` or `replace` (the default). When it is `morph,` when a page refresh happens, instead of replacing the page's `<body>,` Turbo will only update the DOM elements that have changed, keeping the rest untouched. This approach delivers better sensations because it keeps the screen state.
The possible values are `morph` or `replace` (the default). When it is `morph,` when a page refresh happens, instead of replacing the page's `<body>` contents, Turbo will only update the DOM elements that have changed, keeping the rest untouched. This approach delivers better sensations because it keeps the screen state.

Under the hood, Turbo uses the fantastic [idiomorph library](https://github.com/bigskysoftware/idiomorph).

Expand Down
4 changes: 2 additions & 2 deletions _source/handbook/05_streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ Since the document's `<head>` is persistent across Turbo navigations, it's
important to mount the `<turbo-stream-source>` as a descendant of the document's
`<body>` element.

Typical full page navigations driven by Turbo will result in the `<body>` being
discarded and replaced with the resulting document. It's the server's
Typical full page navigations driven by Turbo will result in the `<body>` contents
being discarded and replaced with the resulting document. It's the server's
responsibility to ensure that the element is present on any page that requires
streaming.

Expand Down

0 comments on commit a54529d

Please sign in to comment.