Skip to content

Commit

Permalink
HtmxAjaxHelperContext typedef should have all optional fields (#2701)
Browse files Browse the repository at this point in the history
* all fields of HtmxAjaxHelperContext should be optional

* update docs for htmx.ajax to describe purpose of source field in context
  • Loading branch information
anentropic authored Jul 8, 2024
1 parent 5f7e235 commit d9eb6d7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/htmx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ type HtmxAjaxHelperContext = {
source?: Element | string;
event?: Event;
handler?: HtmxAjaxHandler;
target: Element | string;
target?: Element | string;
swap?: HtmxSwapStyle;
values?: any | FormData;
headers?: Record<string, string>;
Expand Down
2 changes: 1 addition & 1 deletion src/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -5036,7 +5036,7 @@ var htmx = (function() {
* @property {Element|string} [source]
* @property {Event} [event]
* @property {HtmxAjaxHandler} [handler]
* @property {Element|string} target
* @property {Element|string} [target]
* @property {HtmxSwapStyle} [swap]
* @property {Object|FormData} [values]
* @property {Record<string,string>} [headers]
Expand Down
2 changes: 1 addition & 1 deletion www/content/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ or
* `verb` - 'GET', 'POST', etc.
* `path` - the URL path to make the AJAX
* `context` - a context object that contains any of the following
* `source` - the source element of the request
* `source` - the source element of the request, `hx-*` attrs which affect the request will be resolved against that element and its ancestors
* `event` - an event that "triggered" the request
* `handler` - a callback that will handle the response HTML
* `target` - the target to swap the response into
Expand Down

0 comments on commit d9eb6d7

Please sign in to comment.