Skip to content

Commit

Permalink
deploy: 2648c0c
Browse files Browse the repository at this point in the history
  • Loading branch information
dhh committed Sep 15, 2024
1 parent 643d7e5 commit 97bab62
Show file tree
Hide file tree
Showing 3 changed files with 199 additions and 10 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ <h1 class="landing-intro__text grid__item grid__item--start-2 grid__item--span-1
</div>

<p class="landing-version">
<span>Current version: <a href="https://github.com/hotwired/turbo/releases/tag/v8.0.5">8.0.5</a> &mdash; released Jul 19, 2024</span>
<span>Current version: <a href="https://github.com/hotwired/turbo/releases/tag/8.0.6">8.0.6</a> &mdash; released Sep 13, 2024</span>
</p>

<section class="landing-summary">
Expand Down
184 changes: 184 additions & 0 deletions reference/drive.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,190 @@ <h2 id="turbo.setconfirmmethod"><a class="anchor" href="#turbo.setconfirmmethod"
<h2 id="turbo.session.drive"><a class="anchor" href="#turbo.session.drive"></a> Turbo.session.drive</h2>
<pre class="language-js"><code class="language-js">Turbo<span class="token punctuation">.</span>session<span class="token punctuation">.</span>drive <span class="token operator">=</span> <span class="token boolean">false</span></code></pre>
<p>Turns Turbo Drive off by default. You must now opt-in to Turbo Drive on a per-link and per-form basis using <code>data-turbo=&quot;true&quot;</code>.</p>
<h2 id="fetchrequest"><a class="anchor" href="#fetchrequest"></a> <code>FetchRequest</code></h2>
<p>Turbo dispatches a variety of <a href="/reference/events#http-requests">events while making HTTP requests</a> that reference <code>FetchRequest</code> objects with the following properties:</p>
<table>
<thead>
<tr>
<th>Property</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>body</code></td>
<td><a href="https://developer.mozilla.org/en-US/docs/Web/API/FormData">FormData</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams">URLSearchParams</a></td>
<td>a <a href="https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams">URLSearchParams</a> instance for <code>&quot;get&quot;</code> requests, <a href="https://developer.mozilla.org/en-US/docs/Web/API/FormData">FormData</a> otherwise</td>
</tr>
<tr>
<td><code>enctype</code></td>
<td><code>&quot;application/x-www-form-urlencoded&quot; | &quot;multipart/form-data&quot; | &quot;text/plain&quot;</code></td>
<td>the <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/enctype">HTMLFormElement.enctype</a> value</td>
</tr>
<tr>
<td><code>fetchOptions</code></td>
<td><a href="https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options">RequestInit</a></td>
<td>the request’s configuration options</td>
</tr>
<tr>
<td><code>headers</code></td>
<td><a href="https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#headers">Headers</a> | <code>{ [string]: [any] }</code></td>
<td>the request’s HTTP headers</td>
</tr>
<tr>
<td><code>method</code></td>
<td><code>&quot;get&quot; | &quot;post&quot; | &quot;put&quot; | &quot;patch&quot; | &quot;delete&quot;</code></td>
<td>the HTTP verb</td>
</tr>
<tr>
<td><code>params</code></td>
<td><a href="https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams">URLSearchParams</a></td>
<td>the <a href="https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams">URLSearchParams</a> instance for <code>&quot;get&quot;</code> requests</td>
</tr>
<tr>
<td><code>target</code></td>
<td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement">HTMLFormElement</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement">HTMLAnchorElement</a> | <code>FrameElement</code> | <code>null</code></td>
<td>the element responsible for initiating the request</td>
</tr>
<tr>
<td><code>url</code></td>
<td><a href="https://developer.mozilla.org/en-US/docs/Web/API/URL">URL</a></td>
<td>the request’s <a href="https://developer.mozilla.org/en-US/docs/Web/API/URL">URL</a></td>
</tr>
</tbody>
</table>
<h2 id="fetchresponse"><a class="anchor" href="#fetchresponse"></a> <code>FetchResponse</code></h2>
<p>Turbo dispatches a variety of <a href="/reference/events#http-requests">events while making HTTP requests</a> that reference <code>FetchResponse</code> objects with the following properties:</p>
<table>
<thead>
<tr>
<th>Property</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>clientError</code></td>
<td><code>boolean</code></td>
<td><code>true</code> if the status is between 400 and 499, <code>false</code> otherwise</td>
</tr>
<tr>
<td><code>contentType</code></td>
<td><code>string</code></td>
<td>the value of the <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type">Content-Type</a> header</td>
</tr>
<tr>
<td><code>failed</code></td>
<td><code>boolean</code></td>
<td><code>true</code> if the response did not succeed, <code>false</code> otherwise</td>
</tr>
<tr>
<td><code>isHTML</code></td>
<td><code>boolean</code></td>
<td><code>true</code> if the content type is HTML, <code>false</code> otherwise</td>
</tr>
<tr>
<td><code>location</code></td>
<td><a href="https://developer.mozilla.org/en-US/docs/Web/API/URL">URL</a></td>
<td>the value of <a href="https://developer.mozilla.org/en-US/docs/Web/API/Response/url">Response.url</a></td>
</tr>
<tr>
<td><code>redirected</code></td>
<td><code>boolean</code></td>
<td>the value of <a href="https://developer.mozilla.org/en-US/docs/Web/API/Response/redirected">Response.redirected</a></td>
</tr>
<tr>
<td><code>responseHTML</code></td>
<td><code>Promise&lt;string&gt;</code></td>
<td>clones the <code>Response</code> if its HTML, then calls [Response.text()][]</td>
</tr>
<tr>
<td><code>responseText</code></td>
<td><code>Promise&lt;string&gt;</code></td>
<td>clones the <code>Response</code>, then calls [Response.text()][]</td>
</tr>
<tr>
<td><code>response</code></td>
<td><a href="https://developer.mozilla.org/en-US/docs/Web/API/Response">Response</a></td>
<td>the <code>Response</code> instance</td>
</tr>
<tr>
<td><code>serverError</code></td>
<td><code>boolean</code></td>
<td><code>true</code> if the status is between 500 and 599, <code>false</code> otherwise</td>
</tr>
<tr>
<td><code>statusCode</code></td>
<td><code>number</code></td>
<td>the value of <a href="https://developer.mozilla.org/en-US/docs/Web/API/Response/status">Response.status</a></td>
</tr>
<tr>
<td><code>succeeded</code></td>
<td><code>boolean</code></td>
<td><code>true</code> if the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Response/ok">Response.ok</a>, <code>false</code> otherwise</td>
</tr>
</tbody>
</table>
<h2 id="formsubmission"><a class="anchor" href="#formsubmission"></a> <code>FormSubmission</code></h2>
<p>Turbo dispatches a variety of <a href="/reference/events#forms">events while submitting forms</a> that reference <code>FormSubmission</code> objects with the following properties:</p>
<table>
<thead>
<tr>
<th>Property</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>action</code></td>
<td><code>string</code></td>
<td>where the <code>&lt;form&gt;</code> element is submitting to</td>
</tr>
<tr>
<td><code>body</code></td>
<td><a href="https://developer.mozilla.org/en-US/docs/Web/API/FormData">FormData</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams">URLSearchParams</a></td>
<td>the underlying [Request][] payload</td>
</tr>
<tr>
<td><code>enctype</code></td>
<td><code>&quot;application/x-www-form-urlencoded&quot; | &quot;multipart/form-data&quot; | &quot;text/plain&quot;</code></td>
<td>the <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/enctype">HTMLFormElement.enctype</a></td>
</tr>
<tr>
<td><code>fetchRequest</code></td>
<td><a href="#fetchrequest">FetchRequest</a></td>
<td>the underlying <a href="#fetchrequest">FetchRequest</a> instance</td>
</tr>
<tr>
<td><code>formElement</code></td>
<td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement">HTMLFormElement</a></td>
<td>the <code>&lt;form&gt;</code> element to that is submitting</td>
</tr>
<tr>
<td><code>isSafe</code></td>
<td><code>boolean</code></td>
<td><code>true</code> if the <code>method</code> is <code>&quot;get&quot;</code>, <code>false</code> otherwise</td>
</tr>
<tr>
<td><code>location</code></td>
<td><a href="https://developer.mozilla.org/en-US/docs/Web/API/URL">URL</a></td>
<td>the <code>action</code> string transformed into a <a href="https://developer.mozilla.org/en-US/docs/Web/API/URL">URL</a> instance</td>
</tr>
<tr>
<td><code>method</code></td>
<td><code>&quot;get&quot; | &quot;post&quot; | &quot;put&quot; | &quot;patch&quot; | &quot;delete&quot;</code></td>
<td>the HTTP verb</td>
</tr>
<tr>
<td><code>submitter</code></td>
<td>[HTMLButtonElement][] | [HTMLInputElement][] | <code>undefined</code></td>
<td>the element responsible for submitting the <code>&lt;form&gt;</code> element</td>
</tr>
</tbody>
</table>
<p><a class="button" href="/reference/frames">Next: Frames</a></p></section>

<footer class="docs__footer grid__item grid__item--start-4 grid__item--span-8">
Expand Down
23 changes: 14 additions & 9 deletions reference/events.html
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ <h3 id="turbo%3Amorph-element"><a class="anchor" href="#turbo%3Amorph-element">
<h2 id="forms"><a class="anchor" href="#forms"></a> Forms</h2>
<p>Turbo Drive emits events during submission, redirection, and submission failure. The following events fire on the <code>&lt;form&gt;</code> element during submission.</p>
<h3 id="turbo%3Asubmit-start"><a class="anchor" href="#turbo%3Asubmit-start"></a> <code>turbo:submit-start</code></h3>
<p>Fires during a form submission. Access the <code>FormSubmission</code> object with <code>event.detail.formSubmission</code>. Abort form submission (e.g. after validation failure) with <code>event.detail.formSubmission.stop()</code>. Use <code>event.originalEvent.detail.formSubmission.stop()</code> if you’re using jQuery.</p>
<p>Fires during a form submission. Access the <a href="/reference/drive#formsubmission">FormSubmission</a> object with <code>event.detail.formSubmission</code>. Abort form submission (e.g. after validation failure) with <code>event.detail.formSubmission.stop()</code>. Use <code>event.originalEvent.detail.formSubmission.stop()</code> if you’re using jQuery.</p>
<table>
<thead>
<tr>
Expand All @@ -419,13 +419,13 @@ <h3 id="turbo%3Asubmit-start"><a class="anchor" href="#turbo%3Asubmit-start">﹟
<tbody>
<tr>
<td><code>formSubmission</code></td>
<td><code>FormSubmission</code></td>
<td><a href="/reference/drive#formsubmission">FormSubmission</a></td>
<td>the <code>&lt;form&gt;</code> element submission</td>
</tr>
</tbody>
</table>
<h3 id="turbo%3Asubmit-end"><a class="anchor" href="#turbo%3Asubmit-end"></a> <code>turbo:submit-end</code></h3>
<p>Fires after the form submission-initiated network request completes. Access the <code>FormSubmission</code> object with <code>event.detail.formSubmission</code> along with <code>FormSubmissionResult</code> properties included within <code>event.detail</code>.</p>
<p>Fires after the form submission-initiated network request completes. Access the <a href="/reference/drive#formsubmission">FormSubmission</a> object with <code>event.detail.formSubmission</code> along with the properties included within <code>event.detail</code>.</p>
<table>
<thead>
<tr>
Expand All @@ -436,13 +436,18 @@ <h3 id="turbo%3Asubmit-end"><a class="anchor" href="#turbo%3Asubmit-end">﹟</a>
</thead>
<tbody>
<tr>
<td><code>formSubmission</code></td>
<td><a href="/reference/drive#formsubmission">FormSubmission</a></td>
<td>the <code>&lt;form&gt;</code> element submission</td>
</tr>
<tr>
<td><code>success</code></td>
<td><code>boolean</code></td>
<td>a <code>boolean</code> representing the request’s success</td>
</tr>
<tr>
<td><code>fetchResponse</code></td>
<td><code>FetchResponse | null</code></td>
<td><a href="/reference/drive#fetchresponse">FetchResponse</a> | <code>null</code></td>
<td>present when <code>success: true</code>, <code>null</code> when <code>success: false</code></td>
</tr>
<tr>
Expand Down Expand Up @@ -483,7 +488,7 @@ <h3 id="turbo%3Abefore-frame-render"><a class="anchor" href="#turbo%3Abefore-fra
</tbody>
</table>
<h3 id="turbo%3Aframe-render"><a class="anchor" href="#turbo%3Aframe-render"></a> <code>turbo:frame-render</code></h3>
<p>Fires right after a <code>&lt;turbo-frame&gt;</code> element renders its view. The specific <code>&lt;turbo-frame&gt;</code> element is the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Event/target">event.target</a>. Access the <code>FetchResponse</code> object with <code>event.detail.fetchResponse</code> property.</p>
<p>Fires right after a <code>&lt;turbo-frame&gt;</code> element renders its view. The specific <code>&lt;turbo-frame&gt;</code> element is the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Event/target">event.target</a>. Access the <a href="/reference/drive#fetchresponse">FetchResponse</a> object with <code>event.detail.fetchResponse</code> property.</p>
<table>
<thead>
<tr>
Expand All @@ -495,7 +500,7 @@ <h3 id="turbo%3Aframe-render"><a class="anchor" href="#turbo%3Aframe-render">﹟
<tbody>
<tr>
<td><code>fetchResponse</code></td>
<td><code>FetchResponse</code></td>
<td><a href="/reference/drive#fetchresponse">FetchResponse</a></td>
<td>the HTTP request’s response</td>
</tr>
</tbody>
Expand Down Expand Up @@ -542,7 +547,7 @@ <h3 id="turbo%3Abefore-stream-render"><a class="anchor" href="#turbo%3Abefore-st
<tr>
<td><code>newStream</code></td>
<td><code>StreamElement</code></td>
<td>the new <code>&lt;body&gt;</code> element that will replace the document’s current <code>&lt;body&gt;</code> element</td>
<td>the new <code>&lt;turbo-stream&gt;</code> element whose action will be executed</td>
</tr>
<tr>
<td><code>render</code></td>
Expand Down Expand Up @@ -600,7 +605,7 @@ <h3 id="turbo%3Abefore-fetch-response"><a class="anchor" href="#turbo%3Abefore-f
<tbody>
<tr>
<td><code>fetchResponse</code></td>
<td><code>FetchResponse</code></td>
<td><a href="/reference/drive#fetchresponse">FetchResponse</a></td>
<td>the HTTP request’s response</td>
</tr>
</tbody>
Expand All @@ -620,7 +625,7 @@ <h3 id="turbo%3Afetch-request-error"><a class="anchor" href="#turbo%3Afetch-requ
<tbody>
<tr>
<td><code>request</code></td>
<td><code>FetchRequest</code></td>
<td><a href="/reference/drive#fetchrequest">FetchRequest</a></td>
<td>The HTTP request that failed</td>
</tr>
<tr>
Expand Down

0 comments on commit 97bab62

Please sign in to comment.