Documentation

- add entries in the event list and detail for htmx:beforeProcessNode and htmx:afterProcessNode
This commit is contained in:
Ben Pate 2021-01-03 10:45:09 -07:00
parent b4d5e9e2a0
commit 20b1722677
2 changed files with 18 additions and 0 deletions

View File

@ -20,6 +20,14 @@ has been swapped or settled yet, only that the request has finished.
* `detail.target` - the target of the request * `detail.target` - the target of the request
* `detail.requestConfig` - the configuration of the AJAX request * `detail.requestConfig` - the configuration of the AJAX request
### <a name="htmx:afterProcessNode"></a> Event - [`htmx:afterProcessNode`](#htmx:afterProcessNode)
This event is triggered after htmx has initialized a DOM node. It can be useful for extensions to build additional features onto a node.
##### Details
* `detail.elt` - the element that dispatched the request
### <a name="htmx:afterRequest"></a> Event - [`htmx:afterRequest`](#htmx:afterRequest) ### <a name="htmx:afterRequest"></a> Event - [`htmx:afterRequest`](#htmx:afterRequest)
This event is triggered after an AJAX request has finished either in the case of a successful request (although This event is triggered after an AJAX request has finished either in the case of a successful request (although
@ -66,6 +74,14 @@ This event is triggered before any response processing occurs. If the event is
* `detail.target` - the target of the request * `detail.target` - the target of the request
* `detail.requestConfig` - the configuration of the AJAX request * `detail.requestConfig` - the configuration of the AJAX request
### <a name="htmx:beforeProcessNode"></a> Event - [`htmx:beforeProcessNode`](#htmx:beforeProcessNode)
This event is triggered before htmx initializes a DOM node and has processed all of its `hx-` attributes. This gives extensions and other external code the ability to modify the contents of a DOM node before it is processed.
##### Details
* `detail.elt` - the element that dispatched the request
### <a name="htmx:beforeRequest"></a> Event - [`htmx:beforeRequest`](#htmx:beforeRequest) ### <a name="htmx:beforeRequest"></a> Event - [`htmx:beforeRequest`](#htmx:beforeRequest)
This event is triggered before an AJAX request is issued. If the event is cancelled, no request will occur. This event is triggered before an AJAX request is issued. If the event is cancelled, no request will occur.

View File

@ -104,10 +104,12 @@ title: </> htmx - Attributes
| Event | Description | | Event | Description |
|-------|-------------| |-------|-------------|
| [`htmx:afterOnLoad`](/events#htmx:afterOnLoad) | triggered after an AJAX request has completed processing a successful response | [`htmx:afterOnLoad`](/events#htmx:afterOnLoad) | triggered after an AJAX request has completed processing a successful response
| [`htmx:afterProcessNode`](/events#htmx:afterProcessNode) | triggered after htmx has initialized a node
| [`htmx:afterRequest`](/events#htmx:afterRequest) | triggered after an AJAX request has completed | [`htmx:afterRequest`](/events#htmx:afterRequest) | triggered after an AJAX request has completed
| [`htmx:afterSettle`](/events#htmx:afterSettle) | triggered after the DOM has settled | [`htmx:afterSettle`](/events#htmx:afterSettle) | triggered after the DOM has settled
| [`htmx:afterSwap`](/events#htmx:afterSwap) | triggered after new content has been swapped in | [`htmx:afterSwap`](/events#htmx:afterSwap) | triggered after new content has been swapped in
| [`htmx:beforeOnLoad`](/events#htmx:beforeOnLoad) | triggered before any response processing occurs | [`htmx:beforeOnLoad`](/events#htmx:beforeOnLoad) | triggered before any response processing occurs
| [`htmx:beforeProcessNode`](/events#htmx:afterProcessNode) | triggered before htmx initializes a node
| [`htmx:beforeRequest`](/events#htmx:beforeRequest) | triggered before an AJAX request is made | [`htmx:beforeRequest`](/events#htmx:beforeRequest) | triggered before an AJAX request is made
| [`htmx:beforeSwap`](/events#htmx:beforeSwap) | triggered before a swap is done | [`htmx:beforeSwap`](/events#htmx:beforeSwap) | triggered before a swap is done
| [`htmx:configRequest`](/events#htmx:configRequest) | triggered before the request, allows you to customize parameters, headers | [`htmx:configRequest`](/events#htmx:configRequest) | triggered before the request, allows you to customize parameters, headers