diff --git a/.gitignore b/.gitignore index fe483815..f6be4625 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ _site test/scratch/scratch.html .DS_Store +.vscode diff --git a/src/ext/sse.js b/src/ext/sse.js index 4088cd29..75c875a1 100644 --- a/src/ext/sse.js +++ b/src/ext/sse.js @@ -157,7 +157,7 @@ This extension adds support for Server Sent Events to htmx. See /www/extensions }; source.onopen = function (evt) { - api.triggerEvent(elt, "htmx::sseOpen", {source: source}); + api.triggerEvent(elt, "htmx:sseOpen", {source: source}); } // Add message handlers for every `sse-swap` attribute diff --git a/www/content/attributes/hx-delete.md b/www/content/attributes/hx-delete.md index 3bebfcba..d33ca2de 100644 --- a/www/content/attributes/hx-delete.md +++ b/www/content/attributes/hx-delete.md @@ -13,7 +13,7 @@ the HTML into the DOM using a swap strategy: This example will cause the `button` to issue a `DELETE` to `/account` and swap the returned HTML into the `innerHTML` of the `body`. - + ## Notes * `hx-delete` is not inherited @@ -21,3 +21,4 @@ This example will cause the `button` to issue a `DELETE` to `/account` and swap * You can control the swap strategy by using the [hx-swap](@/attributes/hx-swap.md) attribute * You can control what event triggers the request with the [hx-trigger](@/attributes/hx-trigger.md) attribute * You can control the data submitted with the request in various ways, documented here: [Parameters](@/docs.md#parameters) +* To remove the element following a successful `DELETE`, return a `200` status code with an empty body; if the server responds with a `204`, no swap takes place, documented here: [Requests & Responses](@/docs.md#requests) diff --git a/www/content/attributes/hx-swap.md b/www/content/attributes/hx-swap.md index 72c0d794..bd8eef15 100644 --- a/www/content/attributes/hx-swap.md +++ b/www/content/attributes/hx-swap.md @@ -34,7 +34,7 @@ The `hx-swap` attributes supports modifiers for changing the behavior of the swa #### Transition: `transition` -If you want to use the new (View Transitions)[https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API] API +If you want to use the new [View Transitions](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) API when a swap occurs, you can use the `transition:true` option for your swap. You can also enable this feature globally by setting the `htmx.config.globalViewTransitions` config setting to `true`. diff --git a/www/content/essays/hypermedia-on-whatever-youd-like.md b/www/content/essays/hypermedia-on-whatever-youd-like.md index ccc94c98..3ac0f1f2 100644 --- a/www/content/essays/hypermedia-on-whatever-youd-like.md +++ b/www/content/essays/hypermedia-on-whatever-youd-like.md @@ -131,7 +131,7 @@ After all, both htmx and hyperscript are _built in JavaScript_. We couldn't hav JavaScript, which, whatever else one might say, has the great virtue of [_being there_](https://en.wikipedia.org/wiki/Being_There). And we even go so far as to _recommend using_ JavaScript for front-end scripting needs in a hypermedia-driven -application, so long as you script in a [hypermedia-friendly](/hypermedia-friendly-scripting/) way. +application, so long as you script in a [hypermedia-friendly](/essays/hypermedia-friendly-scripting/) way. Further, we wouldn't steer someone away from using JavaScript (or TypeScript) on the _server side_ for a hypermedia-driven application, if that language is the best option for your team. As we said earlier, JavaScript now diff --git a/www/content/examples/delete-row.md b/www/content/examples/delete-row.md index b23f2ca6..ed5a537d 100644 --- a/www/content/examples/delete-row.md +++ b/www/content/examples/delete-row.md @@ -23,7 +23,7 @@ table body: ``` The table body has a [`hx-confirm`](@/attributes/hx-confirm.md) attribute to confirm the delete action. It also -set the target to be the `closest tr` that is, the closest table row, for all the buttons ([`hx-target`](@/attributes/hx-target.md) +set the target to be the `closest tr` that is, the closest table row, for all the buttons ([`hx-target`](@/attributes/hx-target.md) is inherited from parents in the DOM.) The swap specification in [`hx-swap`](@/attributes/hx-swap.md) says to swap the entire target out and to wait 1 second after receiving a response. This last bit is so that we can use the following CSS: @@ -37,9 +37,9 @@ tr.htmx-swapping td { To fade the row out before it is swapped/removed. -Each row has a button with a [`hx-delete`](@/attributes/hx-delete.md) attribute containing the url on which to issue a `DELETE` -request to delete the row from the server. This request responds with empty content, indicating that the row should -be replaced with nothing. +Each row has a button with a [`hx-delete`](@/attributes/hx-delete.md) attribute containing the url on which to issue a `DELETE` +request to delete the row from the server. This request responds with a `200` status code and empty content, indicating that the +row should be replaced with nothing. ```html