Skip to content

Commit 7ea35d0

Browse files
committed
IE fix
1 parent d81690f commit 7ea35d0

8 files changed

Lines changed: 67 additions & 32 deletions

File tree

dist/htmx.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -840,11 +840,14 @@ return (function () {
840840

841841
function attributeHash(elt) {
842842
var hash = 0;
843-
for (var i = 0; i < elt.attributes.length; i++) {
844-
var attribute = elt.attributes[i];
845-
if(attribute.value){ // only include attributes w/ actual values (empty is same as non-existent)
846-
hash = stringHash(attribute.name, hash);
847-
hash = stringHash(attribute.value, hash);
843+
// IE fix
844+
if (elt.attributes) {
845+
for (var i = 0; i < elt.attributes.length; i++) {
846+
var attribute = elt.attributes[i];
847+
if(attribute.value){ // only include attributes w/ actual values (empty is same as non-existent)
848+
hash = stringHash(attribute.name, hash);
849+
hash = stringHash(attribute.value, hash);
850+
}
848851
}
849852
}
850853
return hash;

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

-1 Bytes
Binary file not shown.

src/htmx.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -840,11 +840,14 @@ return (function () {
840840

841841
function attributeHash(elt) {
842842
var hash = 0;
843-
for (var i = 0; i < elt.attributes.length; i++) {
844-
var attribute = elt.attributes[i];
845-
if(attribute.value){ // only include attributes w/ actual values (empty is same as non-existent)
846-
hash = stringHash(attribute.name, hash);
847-
hash = stringHash(attribute.value, hash);
843+
// IE fix
844+
if (elt.attributes) {
845+
for (var i = 0; i < elt.attributes.length; i++) {
846+
var attribute = elt.attributes[i];
847+
if(attribute.value){ // only include attributes w/ actual values (empty is same as non-existent)
848+
hash = stringHash(attribute.name, hash);
849+
hash = stringHash(attribute.value, hash);
850+
}
848851
}
849852
}
850853
return hash;

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.5" integrity="sha384-+xCWLDahFW6be8O9igDEVbaW3NVXG8daKz3Z0L5tr1iy3AJIxx3CWEcXCZhTICnW" crossorigin="anonymous"></script>
116+
<script src="https://unpkg.com/htmx.org@1.8.5" integrity="sha384-TODO" 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/js/htmx.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -840,11 +840,14 @@ return (function () {
840840

841841
function attributeHash(elt) {
842842
var hash = 0;
843-
for (var i = 0; i < elt.attributes.length; i++) {
844-
var attribute = elt.attributes[i];
845-
if(attribute.value){ // only include attributes w/ actual values (empty is same as non-existent)
846-
hash = stringHash(attribute.name, hash);
847-
hash = stringHash(attribute.value, hash);
843+
// IE fix
844+
if (elt.attributes) {
845+
for (var i = 0; i < elt.attributes.length; i++) {
846+
var attribute = elt.attributes[i];
847+
if(attribute.value){ // only include attributes w/ actual values (empty is same as non-existent)
848+
hash = stringHash(attribute.name, hash);
849+
hash = stringHash(attribute.value, hash);
850+
}
848851
}
849852
}
850853
return hash;

www/test/1.8.5/src/htmx.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -840,11 +840,14 @@ return (function () {
840840

841841
function attributeHash(elt) {
842842
var hash = 0;
843-
for (var i = 0; i < elt.attributes.length; i++) {
844-
var attribute = elt.attributes[i];
845-
if(attribute.value){ // only include attributes w/ actual values (empty is same as non-existent)
846-
hash = stringHash(attribute.name, hash);
847-
hash = stringHash(attribute.value, hash);
843+
// IE fix
844+
if (elt.attributes) {
845+
for (var i = 0; i < elt.attributes.length; i++) {
846+
var attribute = elt.attributes[i];
847+
if(attribute.value){ // only include attributes w/ actual values (empty is same as non-existent)
848+
hash = stringHash(attribute.name, hash);
849+
hash = stringHash(attribute.value, hash);
850+
}
848851
}
849852
}
850853
return hash;

www/test/1.8.5/test/scratch/index.html

Lines changed: 33 additions & 10 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)