Skip to content

Commit 9af34ce

Browse files
committed
fix revealed bug
1 parent 90dd251 commit 9af34ce

182 files changed

Lines changed: 117094 additions & 11 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [1.8.2] - 2022-10-12
4+
5+
* Fix regression in `revealed` logic
6+
37
## [1.8.1] - 2022-10-11
48

59
* We now keep a count of outstanding requests for an indicator, so more than one overlapping request can share the same

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ By removing these arbitrary constraints htmx completes HTML as a
3434
## quick start
3535

3636
```html
37-
<script src="https://unpkg.com/htmx.org@1.8.1"></script>
37+
<script src="https://unpkg.com/htmx.org@1.8.2"></script>
3838
<!-- have a button POST a click via AJAX -->
3939
<button hx-post="/clicked" hx-swap="outerHTML">
4040
Click Me

dist/htmx.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ return (function () {
7171
createWebSocket: function(url){
7272
return new WebSocket(url, []);
7373
},
74-
version: "1.8.1"
74+
version: "1.8.2"
7575
};
7676

7777
/** @type {import("./htmx").HtmxInternalApi} */
@@ -1414,7 +1414,7 @@ return (function () {
14141414
if (!hasAttribute(elt,'data-hx-revealed') && isScrolledIntoView(elt)) {
14151415
elt.setAttribute('data-hx-revealed', 'true');
14161416
var nodeData = getInternalData(elt);
1417-
if (nodeData.initHash === attributeHash(elt)) {
1417+
if (nodeData.initHash) {
14181418
triggerEvent(elt, 'revealed');
14191419
} else {
14201420
// if the node isn't initialized, wait for it before triggering the request

dist/htmx.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/htmx.min.js.gz

-5 Bytes
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"AJAX",
66
"HTML"
77
],
8-
"version": "1.8.1",
8+
"version": "1.8.2",
99
"homepage": "https://htmx.org/",
1010
"bugs": {
1111
"url": "https://github.com/bigskysoftware/htmx/issues"

src/htmx.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ return (function () {
7171
createWebSocket: function(url){
7272
return new WebSocket(url, []);
7373
},
74-
version: "1.8.1"
74+
version: "1.8.2"
7575
};
7676

7777
/** @type {import("./htmx").HtmxInternalApi} */
@@ -1414,7 +1414,7 @@ return (function () {
14141414
if (!hasAttribute(elt,'data-hx-revealed') && isScrolledIntoView(elt)) {
14151415
elt.setAttribute('data-hx-revealed', 'true');
14161416
var nodeData = getInternalData(elt);
1417-
if (nodeData.initHash === attributeHash(elt)) {
1417+
if (nodeData.initHash) {
14181418
triggerEvent(elt, 'revealed');
14191419
} else {
14201420
// if the node isn't initialized, wait for it before triggering the request

test/attributes/hx-trigger.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,14 @@ describe("hx-trigger attribute", function(){
747747
div2.innerHTML.should.equal("test 2");
748748
});
749749

750+
it('reveal event works when triggered by window', function()
751+
{
752+
this.server.respondWith("GET", "/test1", "test 1");
753+
var div = make('<div hx-get="/test1" hx-trigger="revealed" style="position: absolute; top: 1px; left: 1px; border: 3px solid red">foo</div>');
754+
div.innerHTML.should.equal("foo");
755+
this.server.respondAll();
756+
div.innerHTML.should.equal("test 1");
757+
});
750758

751759

752760
})

www/docs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ The fastest way to get going with htmx is to load it via a CDN. You can simply a
113113
and get going:
114114

115115
```html
116-
<script src="https://unpkg.com/htmx.org@1.8.1" integrity="sha384-DXaTz/CiqGNRLEu025rPC9D2gEK8Imn+w1e1QtdYD0Bap7LIcHOYjUZAO96YDCX3" crossorigin="anonymous"></script>
116+
<script src="https://unpkg.com/htmx.org@1.8.2" integrity="sha384-DXaTz/CiqGNRLEu025rPC9D2gEK8Imn+w1e1QtdYD0Bap7LIcHOYjUZAO96YDCX3" crossorigin="anonymous"></script>
117117
```
118118

119119
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).

www/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ By removing these arbitrary constraints, htmx completes HTML as a [hypertext](ht
3333
## quick start
3434

3535
```html
36-
<script src="https://unpkg.com/htmx.org@1.8.1"></script>
36+
<script src="https://unpkg.com/htmx.org@1.8.2"></script>
3737
<!-- have a button POST a click via AJAX -->
3838
<button hx-post="/clicked" hx-swap="outerHTML">
3939
Click Me

0 commit comments

Comments
 (0)