Skip to content

Commit

Permalink
Merge branch 'dev' into v2.0v2.0
Browse files Browse the repository at this point in the history
# Conflicts:
#	dist/ext/sse.js
#	dist/ext/ws.js
#	dist/htmx.d.ts
#	dist/htmx.js
#	dist/htmx.min.js
#	dist/htmx.min.js.gz
#	package.json
#	src/ext/sse.js
#	src/htmx.d.ts
#	src/htmx.js
#	test/attributes/hx-sse.js
#	test/core/regressions.js
#	test/ext/sse.js
#	www/static/src/ext/sse.js
#	www/static/src/htmx.d.ts
#	www/static/src/htmx.js
#	www/static/test/attributes/hx-sse.js
#	www/static/test/core/regressions.js
#	www/static/test/ext/sse.js
#	www/themes/htmx-theme/static/js/htmx.js
  • Loading branch information
1cg committed Mar 14, 2024
2 parents e3330db + 9a8e57a commit 2bab9f4
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 11 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [1.9.11] - 2024-04-15

* Fix for new issue w/ web sockets & SSE on iOS 17.4 (thanks apple!)
* Fix for double script execution issue when using template parsing
* Fix TypeScript types file
* Fix SSE Ext: reinstantiate EventSource listeners upon reconnection logic (#2272)

## [1.9.10] - 2023-12-21

* `hx-on*` attributes now support the form `hx-on-`, with a trailing dash, to better support template systems (such as EJS)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ By removing these arbitrary constraints htmx completes HTML as a
## quick start

```html
<script src="https://unpkg.com/[email protected].10"></script>
<script src="https://unpkg.com/[email protected].11"></script>
<!-- have a button POST a click via AJAX -->
<button hx-post="/clicked" hx-swap="outerHTML">
Click Me
Expand Down
5 changes: 2 additions & 3 deletions src/ext/ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ This extension adds support for WebSockets to htmx. See /www/extensions/ws.md f
* @param {Event} evt
*/
onEvent: function (name, evt) {
var parent = evt.target || evt.detail.elt;

switch (name) {

// Try to close the socket when elements are removed
case "htmx:beforeCleanupElement":

var internalData = api.getInternalData(evt.target)
var internalData = api.getInternalData(parent)

if (internalData.webSocket) {
internalData.webSocket.close();
Expand All @@ -53,8 +54,6 @@ This extension adds support for WebSockets to htmx. See /www/extensions/ws.md f

// Try to create websockets when elements are processed
case "htmx:beforeProcessNode":
var parent = evt.target;

forEach(queryAttributeOnThisOrChildren(parent, "ws-connect"), function (child) {
ensureWebSocket(child)
});
Expand Down
2 changes: 1 addition & 1 deletion test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h2>Scratch Page</h2>
</ul>

<h2>Manual Tests</h2>
<a href="manual">Here</a>
<a href="manual/">Here</a>

<h2>Mocha Test Suite</h2>
<a href="index.html">[ALL]</a>
Expand Down
2 changes: 1 addition & 1 deletion www/content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ By removing these constraints, htmx completes HTML as a [hypertext](https://en.w
<h2>quick start</h2>

```html
<script src="https://unpkg.com/[email protected].10"></script>
<script src="https://unpkg.com/[email protected].11"></script>
<!-- have a button POST a click via AJAX -->
<button hx-post="/clicked" hx-swap="outerHTML">
Click Me
Expand Down
2 changes: 1 addition & 1 deletion www/content/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ The fastest way to get going with htmx is to load it via a CDN. You can simply a
and get going:

```html
<script src="https://unpkg.com/[email protected].10" integrity="sha384-D1Kt99CQMDuVetoL1lrYwg5t+9QdHe7NLX/SoJYkXDFfX37iInKRy5xLSi8nO7UC" crossorigin="anonymous"></script>
<script src="https://unpkg.com/[email protected].11" integrity="sha384-TODO" crossorigin="anonymous"></script>
```

While the CDN approach is extremely simple, you may want to consider [not using CDNs in production](https://blog.wesleyac.com/posts/why-not-javascript-cdn).
Expand Down
5 changes: 2 additions & 3 deletions www/static/src/ext/ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ This extension adds support for WebSockets to htmx. See /www/extensions/ws.md f
* @param {Event} evt
*/
onEvent: function (name, evt) {
var parent = evt.target || evt.detail.elt;

switch (name) {

// Try to close the socket when elements are removed
case "htmx:beforeCleanupElement":

var internalData = api.getInternalData(evt.target)
var internalData = api.getInternalData(parent)

if (internalData.webSocket) {
internalData.webSocket.close();
Expand All @@ -53,8 +54,6 @@ This extension adds support for WebSockets to htmx. See /www/extensions/ws.md f

// Try to create websockets when elements are processed
case "htmx:beforeProcessNode":
var parent = evt.target;

forEach(queryAttributeOnThisOrChildren(parent, "ws-connect"), function (child) {
ensureWebSocket(child)
});
Expand Down
2 changes: 1 addition & 1 deletion www/static/test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h2>Scratch Page</h2>
</ul>

<h2>Manual Tests</h2>
<a href="manual">Here</a>
<a href="manual/">Here</a>

<h2>Mocha Test Suite</h2>
<a href="index.html">[ALL]</a>
Expand Down

0 comments on commit 2bab9f4

Please sign in to comment.