htmx.org 2.0.0-beta3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,485 @@
1
+ # Changelog
2
+
3
+ ## [1.9.12] - 2024-04-17
4
+
5
+ * [IE Fixes](https://github.com/bigskysoftware/htmx/commit/e64238dba3113c2eabe26b1e9e9ba7fe29ba3010)
6
+
7
+ ## [1.9.11] - 2024-03-15
8
+
9
+ * Fix for new issue w/ web sockets & SSE on iOS 17.4 (thanks apple!)
10
+ * Fix for double script execution issue when using template parsing
11
+ * Fix TypeScript types file
12
+ * Fix SSE Ext: reinstantiate EventSource listeners upon reconnection logic (#2272)
13
+
14
+ ## [1.9.10] - 2023-12-21
15
+
16
+ * `hx-on*` attributes now support the form `hx-on-`, with a trailing dash, to better support template systems (such as EJS)
17
+ that do not like double colons in HTML attributes.
18
+ * Added an `htmx.config.triggerSpecsCache` configuration property that can be set to an object to cache the trigger spec parsing
19
+ * Added a `path-params.js` extension for populating request paths with variable values
20
+ * Many smaller bug fixes & improvements
21
+
22
+ ## [1.9.9] - 2023-11-21
23
+
24
+ * Allow CSS selectors with whitespace in attributes like `hx-target` by using parens or curly-braces
25
+ * Properly allow users to override the `Content-Type` request header
26
+ * Added the `select` option to `htmx.ajax()`
27
+ * Fixed a race condition in readystate detection that lead to htmx not being initialized in some scenarios with 3rd
28
+ party script loaders
29
+ * Fixed a bug that caused relative resources to resolve against the wrong base URL when a new URL is pushed
30
+ * Fixed a UI issue that could cause indicators to briefly flash
31
+
32
+ ## [1.9.8] - 2023-11-06
33
+
34
+ * Fixed a few npm & build related issues
35
+
36
+ ## [1.9.7] - 2023-11-03
37
+
38
+ * Fixed a bug where a button associated with a form that is swapped out of the DOM caused errors
39
+ * The `hx-target-error` attribute was added to the `response-targets` extension, allowing you to capture all 400 & 500
40
+ responses with a single attribute
41
+ * `hx-on` now properly supports multiple listeners
42
+ * The `hx-confirm` prompt is now passed into custom confirmation handlers
43
+ * `next` and `previous` are now valid _extended CSS_ symbols in htmx
44
+ * The `htmx:beforeHistoryUpdate` event was added
45
+ * Properly ignore the `dialog` formmethod on buttons when resolving the HTTP method to use
46
+ * Added a `htmx.config.scrollIntoViewOnBoost` option that may be set to `false` to disable scrolling the top of the
47
+ body into view for boosted elements
48
+
49
+ ## [1.9.6] - 2023-09-22
50
+
51
+ * IE support has been restored (thank you @telroshan!)
52
+ * Introduced the `hx-disabled-elt` attribute to allow specifying elements to disable during a request
53
+ * You can now explicitly decide to ignore `title` tags found in new content via the `ignoreTitle` option in `hx-swap` and the `htmx.config.ignoreTitle` configuration variable.
54
+ * `hx-swap` modifiers may be used without explicitly specifying the swap mechanism
55
+ * Arrays are now supported in the `client-side-templates` extension
56
+ * XSLT support in the `client-side-templates` extension
57
+ * Support `preventDefault()` in extension event handling
58
+ * Allow the `HX-Refresh` header to apply even after an `HX-Redirect` has occurred
59
+ * the `formaction` and `formmethod` attributes on buttons are now properly respected
60
+ * `hx-on` can now handle events with dots in their name
61
+ * `htmx.ajax()` now always returns a Promise
62
+ * Handle leading `style` tag parsing more effectively
63
+
64
+ ## [1.9.5] - 2023-08-25
65
+
66
+ * Web sockets now properly pass the target id in the HEADERS struct
67
+ * A very rare loading state bug was fixed (see https://github.com/bigskysoftware/htmx/commit/93bd81b6d003bb7bc445f10192bdb8089fa3495d)
68
+ * `hx-on` will not evaluate if `allowEval` is set to false
69
+ * You can disable the interpretation of script tags with the new `htmx.config.allowScriptTags` config variable
70
+ * You can now disable htmx-based requests to non-origin hosts via the `htmx.config.selfRequestsOnly` config variable
71
+ * The [Security](https://htmx.org/docs#security) section has been expanded to help developers better understand how to
72
+ properly secure their htmx-based applications.
73
+
74
+ ## [1.9.4] - 2023-07-25
75
+
76
+ * This is a bug-fix release for the most part, w/a heavy dose of @telroshan
77
+ * The `HX-Trigger` response header now supports comma separated event names
78
+ * Submit buttons that use the `form` attribute now work correctly
79
+ * The `changed` modifier now uses the triggering element, rather than the element the `hx-trigger` is defined on
80
+ * `hx-disable` is now handled dynamically so it can be added and removed
81
+ * IE11 compatibility restored! (maybe, hard to test)
82
+ * Fixed bug with `hx-on` event handler cleanup
83
+ * Many smaller bug fixes, typo fixes and general improvements
84
+
85
+ ## [1.9.3] - 2023-07-14
86
+
87
+ * The `hx-on` attribute has been deprecated (sorry) in favor of `hx-on:<event name>` attributes. See [`hx-on`](/attributes/hx-on) for more information.
88
+ * We now have functioning CI using GitHub actions!
89
+ * You can now configure if a type of HTTP request uses the body for parameters or not. In particular, the `DELETE` _should_ use
90
+ query parameters, according to the spec. htmx has used the body, instead. To avoid breaking code we are keeping this undefined
91
+ behavior for now, but allowing people to fix it for their use cases by updating the `htmx.config.methodsThatUseUrlParams` config
92
+ option. Thank you to Alex and Vincent for their feedback and work on this issue!
93
+ * The `this` symbol is now available in event filter expressions, and refers to the element the `hx-trigger` is on
94
+ * Fix bug where the `htmx:afterSettle` event was raised multiple times with oob swaps occurred
95
+ * A large number of accessibility fixes were made in the docs (Thank you Denis & crew!)
96
+ * Fixed bug w/ WebSocket extension initialization caused by "naked" `hx-trigger` feature
97
+ * The `HX-Reselect` HTTP response header has been added to change the selection from the returned content
98
+ * Many other smaller bug fixes
99
+
100
+ ## [1.9.2] - 2023-04-28
101
+
102
+ * Fixed bug w/ `hx-on` not properly de-initializing
103
+
104
+ ## [1.9.1] - 2023-04-27
105
+
106
+ * Fixed a bug with the new naked triggers that prevented boosted elements with explicit `hx-trigger`'s from functioning
107
+ properly
108
+ * Added code to play well with other libraries that also use the `window.onpopstate` Daily reminder: <https://htmx.org/img/memes/javascripthistory.png>
109
+
110
+ ## [1.9.0] - 2023-04-11
111
+
112
+ * Support for generalized inline event handling via the new [`hx-on`](/attributes/hx-on) attribute, which addresses
113
+ the shortcoming of limited [`onevent` properties](https://developer.mozilla.org/en-US/docs/Web/Events/Event_handlers#using_onevent_properties) attributes in HTML.
114
+ * Support for [view transitions](/docs#view-transitions), based on the experimental [View Transitions API](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
115
+ currently available in Chrome 111+ and coming to other browsers soon.
116
+ * Support for "naked" [`hx-trigger`](/attributes/hx-trigger) attributes, where an `hx-trigger` is present on an element
117
+ that does not have an `hx-get`, etc. defined on it. Instead, it will trigger the new `htmx:triggered` event, which can
118
+ be responded to via your [preferred scripting solution](/docs#scripting).
119
+ * A memory leak fix by [@croxton](https://github.com/bigskysoftware/htmx/commit/8cd3a480a7388877628ce8b9b8e50cd5df48bb81)
120
+ * The htmx website has been migrated from 11ty to [zola](https://www.getzola.org/) by [@danieljsummers](https://github.com/danieljsummers), cutting
121
+ way down on the number of "development" javascript dependencies
122
+ * Many other smaller bug fixes
123
+
124
+ ## [1.8.6] - 2023-03-02
125
+
126
+ * ESM support!
127
+ * Sass has been vanquished from the htmx.org website, which should set us up for some good progress going forward
128
+ * Fixed a bug where the `changed` modifier on `keyup` did not work properly if an input was tabbed into
129
+ * Many other smaller bug fixes and doc fixes
130
+
131
+ ## [1.8.5] - 2023-01-17
132
+
133
+ * Support a new optional cache-busting configuration option, `getCacheBusterParam`, to allow browsers to disambiguate
134
+ between `GET` requests from htmx and from the raw browser
135
+ * Support new `hx-history='false'` attribute, to prevent sensitive data from being stored in the history cache. (Thank you @croxton!)
136
+ * Extensive new event-oriented features are available in the [Web Socket](/extensions/web-sockets/) extension (Thank you @Renerick!)
137
+ * A bug fix for when a form contains multiple empty input values with the same name (Thank you @bluekeyes!)
138
+ * A bug fix around inputs that throw exceptions when calling `setSelectionRange()` (Thank you @gone!)
139
+ * A bug fix to pass through the proper event for the `htmx:configRequest` event
140
+ * A bug fix/improvement for the `preload` extension
141
+ * Many other small bug fixes
142
+
143
+ ## [1.8.4] - 2022-11-05
144
+
145
+ * Fix the _exact same_ regression in `revealed` logic as in 1.8.2
146
+
147
+ ## [1.8.3] - 2022-11-04
148
+
149
+ * A new [`htmx:confirm` event](/events#htmx:confirm) was added that allows for asynchronous confirmation dialogs to
150
+ be integrated into htmx requests
151
+ * The new [head-support](/extensions/head-support) extension allows for more elaborate head tag merging than standard htmx
152
+ supports. This functionality may be integrated into htmx 2.0, depending on feedback.
153
+ * The new [multi-swap](/extensions/multi-swap) provides more elaborate swapping of multiple elements on a screen using
154
+ a custom swap strategy
155
+ * Many doc fixes (thank you to everyone who contributed!)
156
+
157
+ ## [1.8.2] - 2022-10-12
158
+
159
+ * Fix regression in `revealed` logic
160
+
161
+ ## [1.8.1] - 2022-10-11
162
+
163
+ * We now keep a count of outstanding requests for an indicator, so more than one overlapping request can share the same
164
+ indicator without issues
165
+ * We now track the attribute state of an element and re-initialize it if `htmx.process()` is called on the element and
166
+ the attributes have changed
167
+ * [Idiomorph](https://github.com/bigskysoftware/idiomorph) is now available for all your morph-swapping needs
168
+ * The `unset` directive now works properly for `hx-vals` and `hx-vars`
169
+ * The title of the page is now properly set on a history cache miss
170
+ * The new [`hx-validate`](https://htmx.org/attributes/hx-validate) attribute will force elements to validate before a request, even if
171
+ they are not within a form being submitted
172
+ * Many smaller bug and docs fixes
173
+
174
+ ## [1.8.0] - 2022-7-12
175
+
176
+ * **NOTE**: This release involved some changes to touchy code (e.g. history support) so please test thoroughly and let
177
+ us know if you see any issues
178
+ * Boosted forms now will automatically push URLs into history as with links. The [response URL](https://caniuse.com/mdn-api_xmlhttprequest_responseurl)
179
+ detection API support is good enough that we feel comfortable making this the default now.
180
+ * If you do not want this behavior you can add `hx-push-url='false'` to your boosted forms
181
+ * The [`hx-replace-url`](https://htmx.org/attributes/hx-replace-url) attribute was introduced, allowing you to replace
182
+ the current URL in history (to complement `hx-push-url`)
183
+ * Bug fix - if htmx is included in a page more than once, we do not process elements multiple times
184
+ * Bug fix - When localStorage is not available we do not attempt to save history in it
185
+ * [Bug fix](https://github.com/bigskysoftware/htmx/issues/908) - `hx-boost` respects the `enctype` attribute
186
+ * `m` is now a valid timing modifier (e.g. `hx-trigger="every 2m"`)
187
+ * `next` and `previous` are now valid extended query selector modifiers, e.g. `hx-target="next div"` will target the
188
+ next div from the current element
189
+ * Bug fix - `hx-boost` will boost anchor tags with a `_self` target
190
+ * The `load` event now properly supports event filters
191
+ * The websocket extension has had many improvements: (A huge thank you to Denis Palashevskii, our newest committer on the project!)
192
+ * Implement proper `hx-trigger` support
193
+ * Expose trigger handling API to extensions
194
+ * Implement safe message sending with sending queue
195
+ * Fix `ws-send` attributes connecting in new elements
196
+ * Fix OOB swapping of multiple elements in response
197
+ * The `HX-Location` response header now implements client-side redirects entirely within htmx
198
+ * The `HX-Reswap` response header allows you to change the swap behavior of htmx
199
+ * The new [`hx-select-oob`](https://htmx.org/attributes/hx-select-oob) attribute selects one or more elements from a server response to swap in via an out of band swap
200
+ * The new [`hx-replace-url`](https://htmx.org/attributes/hx-replace-url) attribute can be used to replace the current URL in the location
201
+ bar (very similar to `hx-push-url` but no new history entry is created). The corresponding `HX-Replace-Url` response header can be used as well.
202
+ * htmx now properly handles anchors in both boosted links, as well as in `hx-get`, etc. attributes
203
+
204
+ ## [1.7.0] - 2022-02-22
205
+
206
+ * The new [`hx-sync`](https://htmx.org/attributes/hx-sync) attribute allows you to synchronize multiple element requests on a single
207
+ element using various strategies (e.g. replace)
208
+ * You can also now abort an element making a request by sending it the `htmx:abort` event
209
+ * [Server Sent Events](/extensions/server-sent-events) and [Web Sockets](/extensions/web-sockets) are now available as
210
+ extensions, in addition to the normal core support. In htmx 2.0, the current `hx-sse` and `hx-ws` attributes will be
211
+ moved entirely out to these new extensions. By moving these features to extensions we will be able to add functionality
212
+ to both of them without compromising the core file size of htmx. You are encouraged to move over to the new
213
+ extensions, but `hx-sse` and `hx-ws` will continue to work indefinitely in htmx 1.x.
214
+ * You can now mask out [attribute inheritance](/docs#inheritance) via the [`hx-disinherit`](https://htmx.org/attributes/hx-disinherit) attribute.
215
+ * The `HX-Push` header can now have the `false` value, which will prevent a history snapshot from occurring.
216
+ * Many new extensions, with a big thanks to all the contributors!
217
+ * A new [`alpine-morph`](/extensions/alpine-morph) allows you to use Alpine's swapping engine, which preserves Alpine
218
+ * A [restored](/extensions/restored) extension was added that will trigger a `restore` event on all elements in the DOM
219
+ on history restoration.
220
+ * A [loading-states](/extensions/loading-states) extension was added that allows you to easily manage loading states
221
+ while a request is in flight, including disabling elements, and adding and removing CSS classes.
222
+ * The `this` symbol now resolves properly for the [`hx-include`](https://htmx.org/attributes/hx-include) and [`hx-indicator`](https://htmx.org/attributes/hx-indicator)
223
+ attributes
224
+ * When an object is included via the [`hx-vals`](https://htmx.org/attributes/hx-vals) attribute, it will be converted to JSON (rather
225
+ than rendering as the string `[Object object]"`)
226
+ * You can now pass a swap style in to the `htmx.ajax()` function call.
227
+ * Poll events now contain a `target` attribute, allowing you to filter a poll on the element that is polling.
228
+ * Two new Out Of Band-related events were added: `htmx:oobBeforeSwap` & `htmx:oobAfterSwap`
229
+
230
+ ## [1.6.1] - 2021-11-22
231
+
232
+ * A new `HX-Retarget` header allows you to change the default target of returned content
233
+ * The `htmx:beforeSwap` event now includes another configurable property: `detail.isError` which can
234
+ be used to indicate if a given response should be treated as an error or not
235
+ * The `htmx:afterRequest` event has two new detail properties: `success` and `failed`, allowing you to write
236
+ trigger filters in htmx or hyperscript:
237
+ ```applescript
238
+ on htmx:afterRequest[failed]
239
+ set #myCheckbox's checked to true
240
+ ```
241
+ * Fixed the `from:` option in [`hx-trigger`](https://htmx.org/attributes/hx-trigger) to support `closest <CSS selector>`
242
+ and `find <CSS selector>` forms
243
+ * Don't boost anchor tags with an explicit `target` set
244
+ * Don't cancel all events on boosted elements, only the events that naturally trigger them (click for anchors, submit
245
+ for forms)
246
+ * Persist revealed state in the DOM so that on history navigation, revealed elements are not re-requested
247
+ * Process all [`hx-ext`](https://htmx.org/attributes/hx-ext) attributes, even if no other htmx attribute is on the element
248
+ * Snapshot the current URL on load so that history support works properly after a page refresh occurs
249
+ * Many, many documentation updates (thank you to all the contributors!)
250
+
251
+
252
+ ## [1.6.0] - 2021-10-01
253
+
254
+ * Completely reworked `<script>` tag support that now supports the `<script src="...'/>` form
255
+ * You can now use the value `unset` to clear a property that would normally be inherited (e.g. hx-confirm)
256
+ * The `htmx-added` class is added to new content before a swap and removed after the settle phase, which allows you
257
+ more flexibility in writing CSS transitions for added content (rather than relying on the target, as with `htmx-settling`)
258
+ * The `htmx:beforeSwap` event has been updated to allow you to [configure swapping](https://htmx.org/docs/#modifying_swapping_behavior_with_events)
259
+ behavior
260
+ * Improved `<title>` extraction support
261
+ * You can listen to events on the `window` object using the `from:` modifier in `hx-trigger`
262
+ * The `root` option of the `intersect` event was fixed
263
+ * Boosted forms respect the `enctype` declaration
264
+ * The `HX-Boosted` header will be sent on requests from boosted elements
265
+ * Promises are not returned from the main ajax function unless it is an api call (i.e. `htmx.ajax`)
266
+
267
+ ## [1.5.0] - 2021-7-12
268
+
269
+ * Support tracking of button clicked during a form submission
270
+ * Conditional polling via the [hx-trigger](https://htmx.org/attributes/hx-trigger) attribute
271
+ * `document` is now a valid pseudo-selector on the [hx-trigger](https://htmx.org/attributes/hx-trigger) `from:` argument, allowing you
272
+ to listen for events on the document.
273
+ * Added the [hx-request](https://htmx.org/attributes/hx-request) attribute, allowing you to configure the following aspects of the request
274
+ * `timeout` - the timeout of the request
275
+ * `credentials` - if the request will send credentials
276
+ * `noHeaders` - strips all headers from the request
277
+ * Along with the above attribute, you can configure the default values for each of these via the corresponding `htmx.config`
278
+ properties (e.g. `htmx.config.timeout`)
279
+ * Both the `scroll` and `show` options on [hx-swap](https://htmx.org/attributes/hx-swap) now support extended syntax for selecting the
280
+ element to scroll or to show, including the pseudo-selectors `window:top` and `window:bottom`.
281
+
282
+ ## [1.4.1] - 2021-6-1
283
+
284
+ * typo fix
285
+
286
+ ## [1.4.0] - 2021-5-25
287
+
288
+ * Added the `queue` option to the [hx-trigger](https://htmx.org/attributes/hx-trigger) attribute, allowing you to specify how events
289
+ should be queued when they are received with a request in flight
290
+ * The `htmx.config.useTemplateFragments` option was added, allowing you to use HTML template tags for parsing content
291
+ from the server. This allows you to use Out of Band content when returning things like table rows, but it is not
292
+ IE11 compatible.
293
+ * The `defaultSettleDelay` was dropped to 20ms from 100ms
294
+ * Introduced a new synthetic event, [intersect](https://htmx.org/docs#pecial-events) that allows you to trigger when an item is scrolled into view
295
+ as specified by the `IntersectionObserver` API
296
+ * Fixed timing issue that caused exceptions in the `reveal` logic when scrolling at incredible speeds - <https://github.com/bigskysoftware/htmx/issues/463>
297
+ * Fixed bug causing SVG titles to be incorrectly used as page title - <https://github.com/bigskysoftware/htmx/issues/459>
298
+ * Boosted forms that issue a GET will now push the URL by default - <https://github.com/bigskysoftware/htmx/issues/485>
299
+ * Better dispatch of request events when an element is removed from the DOM
300
+ * Fixed a bug causing `hx-prompt` to fail
301
+ * The `htmx.config.withCredentials` option was added, to send credentials with ajax requests (default is `false`)
302
+ * The `throttle` option on `hx-trigger` does not delay the initial request any longer
303
+ * The `meta` key is ignored on boosted links
304
+ * `<script>` tags are now evaluated in the global scope
305
+ * `hx-swap` now supports the `none` option
306
+ * Safari text selection bug - <https://github.com/bigskysoftware/htmx/issues/438>
307
+
308
+ ## [1.3.3] - 2021-4-5
309
+
310
+ * Added the [`hx-disabled`](https://htmx.org/docs#security) attribute to allow htmx to be turned off for parts of the DOM
311
+ * SSE now uses a full-jitter exponential backoff algorithm on reconnection, using the `htmx.config.wsReconnectDelay`
312
+ setting
313
+
314
+ ## [1.3.2] - 2021-3-9
315
+
316
+ * Bug fixes
317
+
318
+ ## [1.3.1] - 2021-3-9
319
+
320
+ * IE11 fixes
321
+
322
+ ## [1.3.0] - 2021-3-6
323
+
324
+ * Support a `target` modifier on `hx-trigger` to filter based on the element targeted by an event. This allows
325
+ lazy binding to that target selector.
326
+ * Events are no longer consumed by the first element that might handle them, unless the `consume` keyword is
327
+ added to the `hx-trigger` specification
328
+ * Added the `htmx:beforeSend` event, fired just before an ajax request begins
329
+ * SSE swaps are properly settled
330
+ * Fixed bug that was improperly cancelling all clicks on anchors
331
+ * `htmx.ajax()` now returns a promise
332
+
333
+ ## [1.2.1] - 2021-2-19
334
+
335
+ * Fixed an issue with the history cache, where the cache was getting blown out after the first navigation backwards
336
+ * Added the `htmx.config.refreshOnHistoryMiss` option, allowing users to trigger a full page refresh on history cache miss
337
+ rather than issuing an AJAX request
338
+
339
+ ## [1.2.0] - 2021-2-13
340
+
341
+ ### New Features
342
+
343
+ * `hx-vars` has been deprecated in favor of `hx-vals`
344
+ * `hx-vals` now supports a `javascript:` prefix to achieve the behavior that `hx-vars` provided
345
+ * The new `hx-headers` attribute allows you to add headers to a request via an attribute. Like `hx-vals` it supports
346
+ JSON or javascript via the `javascript:` prefix
347
+ * `hx-include` will now include all inputs under an element, even if that element is not a form tag
348
+ * The [preload extension](https://htmx.org/extensions/preload/) now offers a `preload-images="true"` attribute that will aggressively load images in preloaded content
349
+ * On requests driven by a history cache miss, the new `HX-History-Restore-Request` header is included so that the server
350
+ can differentiate between history requests and normal requests
351
+
352
+ ### Improvements & Bug fixes
353
+
354
+ * Improved handling of precedence of input values to favor the enclosing form (see [here](https://github.com/bigskysoftware/htmx/commit/a10e43d619dc340aa324d37772c06a69a2f47ec9))
355
+ * Moved event filtering logic *after* `preventDefault` so filtering still allows events to be properly handled
356
+ * No longer trigger after swap events on elements that have been removed via an `outerHTML` swap
357
+ * Properly remove event handlers added to other elements when an element is removed from the DOM
358
+ * Handle the `scroll:` modifier in `hx-swap` properly when an `outerHTML` swap occurs
359
+ * Lots of docs fixes
360
+
361
+ ## [1.1.0] - 2021-1-6
362
+
363
+ * Newly added [preload extension](https://htmx.org/extensions/preload/) allows you to preload resources for lower
364
+ latency requests!
365
+ * Support the `ignore:` modifier for extensions
366
+ * Updated form variable order inclusion to include the enclosing form *last* so that, in the presence of multiple
367
+ values, the most relevant value is the most likely to be selected by the server
368
+ * Support for the [`htmx.ajax()`](https://dev.htmx.org/api/#ajax) javascript function, to issue an htmx-style ajax
369
+ request from javascript
370
+ * Removed the following htmx request headers for better cache behavior: `HX-Event-Target`, `HX-Active-Element`,
371
+ `HX-Active-Element-Name`, `HX-Active-Element-Value`
372
+ * Added the [`hx-preserve`](https://dev.htmx.org/attributes/hx-preserve) attribute, which allows
373
+ you to preserve elements across requests (for example, to keep a video element playing properly)
374
+ * The [path-deps](https://dev.htmx.org/extensions/path-deps/#refresh) now surfaces a small api
375
+ for refreshing path dependencies manually in javascript
376
+ * Now support the `from:` clause on [`hx-trigger`](https://dev.htmx.org/attributes/hx-trigger) to
377
+ allow an element to respond to events on other elements.
378
+ * Added the `htmx:beforeProcessNode` event, renamed the (previously undocumented) `htmx:processedNode` to `htmx:afterProcessNode`
379
+ * Added `closest` syntax support for the [`hx-indicator`](https://dev.htmx.org/attributes/hx-indicator) attribute
380
+ * Added `on load` support for the newest version of [hyperscript](https://hyperscript.org)
381
+ * Added the `htmx.config.allowEval` configuration value, for CSP compatibility
382
+ * Bug fixes & improvements
383
+
384
+ ## [1.0.2] - 2020-12-12
385
+
386
+ * Extend all API methods to take a string selector as well as an element
387
+ * Out of band swap elements need not be top level now
388
+ * [`hx-swap-oob`](https://htmx.org/attributes/hx-swap-oob) now can accept a CSS selector to retarget with
389
+
390
+ ## [1.0.1] - 2020-12-04
391
+
392
+ * AJAX file upload now correctly fires events, allowing for [a proper progress bar](https://htmx.org/examples/file-upload)
393
+ * htmx api functions that expect an element now can accept a string selector instead:
394
+ ```js
395
+ htmx.on('#form', 'htmx:xhr:progress', function(evt) {
396
+ htmx.find('#progress').setAttribute('value', evt.detail.loaded/evt.detail.total * 100)
397
+ });
398
+ ```
399
+ * htmx now properly handles the `multiple` attribute on `<select>` elements
400
+
401
+ ## [1.0.0] - 2020-11-24
402
+
403
+ * Bumped the release version :)
404
+
405
+ ## [0.4.1] - 2020-11-23
406
+
407
+ * Fixed bug with title tag support when title tag contained HTML entities
408
+ * Pass properties for the `loadstart`, `loadend`, `progress`, `abort` events through properly to the htmx equivalents
409
+
410
+ ## [0.4.0] - 2020-11-16
411
+
412
+ * Now support the `HX-Redirect` and `HX-Refresh` response headers for redirecting client side and triggering a page refresh, respectively
413
+ * `hx-vars` now overrides input values
414
+ * `<title>` tags in responses will be used to update page titles
415
+ * All uses of `eval()` have been removed in favor of `Function`
416
+ * [`hx-vals`](https://htmx.org/attributes/hx-vals) is available as a safe alternative to `hx-vars`. It uses `JSON.parse()` rather than evaluation, if you wish to safely pass user-provided values through to htmx.
417
+
418
+ ## [0.3.0] - 2020-10-27
419
+
420
+ * `hx-trigger` parsing has been rewritten and now supports [trigger filters](https://htmx.org/docs/#trigger-filters) to filter
421
+ events based on arbitrary javascript expressions
422
+ * htmx now supports two additional response headers `HX-Trigger-After-Swap` and `HX-Trigger-After-Settle` allowing
423
+ an event to be triggered after a given life cycle event (instead of before the swap)
424
+ * The `requestConfig` is now passed out to events surrounding the AJAX life cycle
425
+ * htmx now evaluates `<script>` tags as javascript when no language is defined on them
426
+ * A new [`event-header`](https://htmx.org/extensions/event-header) extension, which will include a serialized JSON representation of the triggering event in requests
427
+
428
+ ## [0.2.0] - 2020-9-30
429
+
430
+ * AJAX file upload [support](https://htmx.org/docs#files)
431
+ * The HTML validation API is [respected](https://htmx.org/docs#validation)
432
+
433
+ ## [0.1.0] - 2020-9-18
434
+
435
+ * *BREAKING CHANGE*: The SSE attribute [`hx-sse`](https://htmx.org/attributes/hx-sse/) and the Web Sockets attribute [`hx-ws`](https://htmx.org/attributes/hx-ws) have changed syntax to now use colon separators: `hx-sse='connect:/chat swap:message'`
436
+ * The SSE attribute [`hx-sse`](https://htmx.org/attributes/hx-sse/) allows for swapping content directly on an event, in addition to triggering an htmx element,
437
+ with the new `swap:<event name>` syntax.
438
+ * [`hx-target`](https://htmx.org/attributes/hx-target) now supports a `find` syntax to find elements below the element by a CSS selector
439
+ * htmx plays better with deferred loading and many package managers
440
+ * All htmx events are dispatched in both camelCase as well as kebab-case, for better compatibility with AlpineJS and other frameworks. (e.g. `htmx:afterOnLoad` will also be triggered as
441
+ `htmx:after-on-load`)
442
+ * [hypeerscript](https://hyperscript.org) is now initialized independently of htmx
443
+
444
+ ## [0.0.8] - 2020-7-8
445
+
446
+ * The `view` modifier on `hx-swap` has been renamed to `show`: `hx-swap='innerHTML show:top'`
447
+
448
+ ## [0.0.7] - 2020-6-30
449
+
450
+ * The [`hx-swap`](https://htmx.org/attributes/hx-swap) attribute now supports two new modifiers:
451
+ * `scroll` - allows you to scroll the target to the `top` or `bottom`
452
+ * `view` - allows you to scroll the `top` or `bottom` of the target into view
453
+ * The [`hx-push-url`](https://htmx.org/attributes/hx-push-url) attribute now can optionally take a URL to push, in addition to `true` and `false`
454
+ * Added the [`hx-vars`](https://htmx.org/attributes/hx-vars) attribute that allows you to dynamically add to the parameters that will be submitted with a request
455
+
456
+ ## [0.0.6] - 2020-6-20
457
+
458
+ * Custom request/response headers no longer start with the `X-` prefix, which is no longer recommended
459
+ * empty verb attributes are now allowed and follow the anchor tag semantics (e.g. `<div hx-get></div>`)
460
+ * nunjuks inline rendering is now supported in the `client-side-templates` extension
461
+ * the new `ajax-header` extension includes the `X-Requested-With` header
462
+ * bad JSON is now handled more gracefully
463
+ * `hx-swap="none"` will cause no swap to take place <https://github.com/bigskysoftware/htmx/issues/89>
464
+ * `hx-trigger` now supports a `throttle` modifier <https://github.com/bigskysoftware/htmx/issues/88>
465
+ * the focused element is preserved if possible after a replacement
466
+ * perf improvements for large DOM trees with sparse `hx-` annotations
467
+
468
+ ## [0.0.4] - 2020-5-24
469
+
470
+ * Extension mechanism added
471
+ * SSE support added
472
+ * WebSocket support added
473
+
474
+ ## [0.0.3] - 2020-5-17
475
+
476
+ * Renamed to htmx
477
+ * A bug fix for the `hx-prompt` attribute
478
+ * A bug fix for multiple `hx-swap-oob` attributes
479
+ * Moved the default CSS indicator injection into its own sheet to avoid breaking
480
+ * Added the `htmx.config.includeIndicatorStyles` configuration option so people can opt out of injecting the indicator CSS
481
+
482
+
483
+ ## [0.0.1] - 2020-5-15
484
+
485
+ * Initial release (originally named kutty)
package/README.md CHANGED
@@ -33,7 +33,7 @@ By removing these arbitrary constraints htmx completes HTML as a
33
33
  ## quick start
34
34
 
35
35
  ```html
36
- <script src="https://unpkg.com/htmx.org@2.0.0-beta3"></script>
36
+ <script src="https://unpkg.com/htmx.org@2.0.0"></script>
37
37
  <!-- have a button POST a click via AJAX -->
38
38
  <button hx-post="/clicked" hx-swap="outerHTML">
39
39
  Click Me
@@ -70,8 +70,6 @@ No time? Then [become a sponsor](https://github.com/sponsors/bigskysoftware#spon
70
70
 
71
71
  To develop htmx locally, you will need to install the development dependencies.
72
72
 
73
- __Requires Node 15.__
74
-
75
73
  Run:
76
74
 
77
75
  ```
package/dist/htmx.amd.js CHANGED
@@ -165,6 +165,12 @@ var htmx = (function() {
165
165
  * @default ''
166
166
  */
167
167
  inlineScriptNonce: '',
168
+ /**
169
+ * If set, the nonce will be added to inline styles.
170
+ * @type string
171
+ * @default ''
172
+ */
173
+ inlineStyleNonce: '',
168
174
  /**
169
175
  * The attributes to settle during the settling phase.
170
176
  * @type string[]
@@ -272,7 +278,7 @@ var htmx = (function() {
272
278
  parseInterval: null,
273
279
  /** @type {typeof internalEval} */
274
280
  _: null,
275
- version: '2.0.0-beta3'
281
+ version: '2.0.0'
276
282
  }
277
283
  // Tsc madness part 2
278
284
  htmx.onLoad = onLoadHelper
@@ -2252,6 +2258,13 @@ var htmx = (function() {
2252
2258
  getRawAttribute(elt, 'href').indexOf('#') !== 0
2253
2259
  }
2254
2260
 
2261
+ /**
2262
+ * @param {Element} elt
2263
+ */
2264
+ function eltIsDisabled(elt) {
2265
+ return closest(elt, htmx.config.disableSelector)
2266
+ }
2267
+
2255
2268
  /**
2256
2269
  * @param {Element} elt
2257
2270
  * @param {HtmxNodeInternalData} nodeData
@@ -2274,7 +2287,7 @@ var htmx = (function() {
2274
2287
  triggerSpecs.forEach(function(triggerSpec) {
2275
2288
  addEventListener(elt, function(node, evt) {
2276
2289
  const elt = asElement(node)
2277
- if (closest(elt, htmx.config.disableSelector)) {
2290
+ if (eltIsDisabled(elt)) {
2278
2291
  cleanUpElement(elt)
2279
2292
  return
2280
2293
  }
@@ -2636,8 +2649,21 @@ var htmx = (function() {
2636
2649
  function findElementsToProcess(elt) {
2637
2650
  if (elt.querySelectorAll) {
2638
2651
  const boostedSelector = ', [hx-boost] a, [data-hx-boost] a, a[hx-boost], a[data-hx-boost]'
2652
+
2653
+ const extensionSelectors = []
2654
+ for (const e in extensions) {
2655
+ const extension = extensions[e]
2656
+ if (extension.getSelectors) {
2657
+ var selectors = extension.getSelectors()
2658
+ if (selectors) {
2659
+ extensionSelectors.push(selectors)
2660
+ }
2661
+ }
2662
+ }
2663
+
2639
2664
  const results = elt.querySelectorAll(VERB_SELECTOR + boostedSelector + ", form, [type='submit']," +
2640
- ' [hx-ext], [data-hx-ext], [hx-trigger], [data-hx-trigger]')
2665
+ ' [hx-ext], [data-hx-ext], [hx-trigger], [data-hx-trigger]' + extensionSelectors.flat().map(s => ', ' + s).join(''))
2666
+
2641
2667
  return results
2642
2668
  } else {
2643
2669
  return []
@@ -2696,7 +2722,7 @@ var htmx = (function() {
2696
2722
  }
2697
2723
 
2698
2724
  /**
2699
- * @param {EventTarget} elt
2725
+ * @param {Element} elt
2700
2726
  * @param {string} eventName
2701
2727
  * @param {string} code
2702
2728
  */
@@ -2709,6 +2735,9 @@ var htmx = (function() {
2709
2735
  /** @type EventListener */
2710
2736
  const listener = function(e) {
2711
2737
  maybeEval(elt, function() {
2738
+ if (eltIsDisabled(elt)) {
2739
+ return
2740
+ }
2712
2741
  if (!func) {
2713
2742
  func = new Function('event', code)
2714
2743
  }
@@ -3318,6 +3347,9 @@ var htmx = (function() {
3318
3347
  }
3319
3348
  })
3320
3349
  new FormData(elt).forEach(function(value, name) {
3350
+ if (value instanceof File && value.name === '') {
3351
+ return // ignore no-name files
3352
+ }
3321
3353
  addValueToFormData(name, value, formData)
3322
3354
  })
3323
3355
  }
@@ -4755,6 +4787,7 @@ var htmx = (function() {
4755
4787
  function extensionBase() {
4756
4788
  return {
4757
4789
  init: function(api) { return null },
4790
+ getSelectors: function() { return null },
4758
4791
  onEvent: function(name, evt) { return true },
4759
4792
  transformResponse: function(text, xhr, elt) { return text },
4760
4793
  isInlineSwap: function(swapStyle) { return false },
@@ -4853,8 +4886,9 @@ var htmx = (function() {
4853
4886
 
4854
4887
  function insertIndicatorStyles() {
4855
4888
  if (htmx.config.includeIndicatorStyles !== false) {
4889
+ const nonceAttribute = htmx.config.inlineStyleNonce ? ` nonce="${htmx.config.inlineStyleNonce}"` : ''
4856
4890
  getDocument().head.insertAdjacentHTML('beforeend',
4857
- '<style>\
4891
+ '<style' + nonceAttribute + '>\
4858
4892
  .' + htmx.config.indicatorClass + '{opacity:0}\
4859
4893
  .' + htmx.config.requestClass + ' .' + htmx.config.indicatorClass + '{opacity:1; transition: opacity 200ms ease-in;}\
4860
4894
  .' + htmx.config.requestClass + '.' + htmx.config.indicatorClass + '{opacity:1; transition: opacity 200ms ease-in;}\