port back double exec tests from 2.x to ensure its not an issue in 1.x, bump version

This commit is contained in:
Carson Gross 2024-03-01 15:50:21 -07:00
parent 13ff1963b5
commit 9431183cf1
7 changed files with 41 additions and 6 deletions

View File

@ -1,6 +1,8 @@
# Changelog
## [1.9.10] - 2023-12-21
## [1.9.12] - 2024-04-??
## [1.9.12] - 2023-12-21
* `hx-on*` attributes now support the form `hx-on-`, with a trailing dash, to better support template systems (such as EJS)
that do not like double colons in HTML attributes.

View File

@ -33,7 +33,7 @@ By removing these arbitrary constraints htmx completes HTML as a
## quick start
```html
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
<script src="https://unpkg.com/htmx.org@1.9.11"></script>
<!-- have a button POST a click via AJAX -->
<button hx-post="/clicked" hx-swap="outerHTML">
Click Me

View File

@ -5,7 +5,7 @@
"AJAX",
"HTML"
],
"version": "1.9.10",
"version": "1.9.11",
"homepage": "https://htmx.org/",
"bugs": {
"url": "https://github.com/bigskysoftware/htmx/issues"

View File

@ -89,7 +89,7 @@ return (function () {
sock.binaryType = htmx.config.wsBinaryType;
return sock;
},
version: "1.9.10"
version: "1.9.11"
};
/** @type {import("./htmx").HtmxInternalApi} */

View File

@ -212,4 +212,37 @@ describe("Core htmx Regression Tests", function(){
var input = byId("id_email");
input.value.should.equal("supertest@test.com");
});
it("script tags only execute once", function(done) {
window.i = 0; // set count to 0
this.server.respondWith('GET', '/test', '<script>console.trace(); window.i++</script>') // increment the count by 1
// make a div w/ a short settle delay to make the problem more obvious
var div = make('<div hx-get="/test" hx-swap="innerHTML settle:5ms"/>');
div.click();
this.server.respond()
setTimeout(function(){
window.i.should.equal(1);
delete window.i;
done();
}, 50)
})
it("script tags only execute once when nested", function(done) {
window.i = 0; // set count to 0
this.server.respondWith('GET', '/test', '<p>foo</p><div><script>console.trace(); window.i++</script></div>') // increment the count by 1
// make a div w/ a short settle delay to make the problem more obvious
var div = make('<div hx-get="/test" hx-swap="innerHTML settle:5ms"/>');
div.click();
this.server.respond()
setTimeout(function(){
window.i.should.equal(1);
delete window.i;
done();
}, 50)
})
});

View File

@ -37,7 +37,7 @@ By removing these arbitrary constraints, htmx completes HTML as a [hypertext](ht
<h2>quick start</h2>
```html
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
<script src="https://unpkg.com/htmx.org@1.9.11"></script>
<!-- have a button POST a click via AJAX -->
<button hx-post="/clicked" hx-swap="outerHTML">
Click Me

View File

@ -114,7 +114,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/htmx.org@1.9.10" integrity="sha384-D1Kt99CQMDuVetoL1lrYwg5t+9QdHe7NLX/SoJYkXDFfX37iInKRy5xLSi8nO7UC" crossorigin="anonymous"></script>
<script src="https://unpkg.com/htmx.org@1.9.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).