Skip to content

Commit

Permalink
IE fix
Browse files Browse the repository at this point in the history
  • Loading branch information
1cg committed Jan 17, 2023
1 parent d81690f commit 7ea35d0
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 32 deletions.
13 changes: 8 additions & 5 deletions dist/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -840,11 +840,14 @@ return (function () {

function attributeHash(elt) {
var hash = 0;
for (var i = 0; i < elt.attributes.length; i++) {
var attribute = elt.attributes[i];
if(attribute.value){ // only include attributes w/ actual values (empty is same as non-existent)
hash = stringHash(attribute.name, hash);
hash = stringHash(attribute.value, hash);
// IE fix
if (elt.attributes) {
for (var i = 0; i < elt.attributes.length; i++) {
var attribute = elt.attributes[i];
if(attribute.value){ // only include attributes w/ actual values (empty is same as non-existent)
hash = stringHash(attribute.name, hash);
hash = stringHash(attribute.value, hash);
}
}
}
return hash;
Expand Down
2 changes: 1 addition & 1 deletion dist/htmx.min.js

Large diffs are not rendered by default.

Binary file modified dist/htmx.min.js.gz
Binary file not shown.
13 changes: 8 additions & 5 deletions src/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -840,11 +840,14 @@ return (function () {

function attributeHash(elt) {
var hash = 0;
for (var i = 0; i < elt.attributes.length; i++) {
var attribute = elt.attributes[i];
if(attribute.value){ // only include attributes w/ actual values (empty is same as non-existent)
hash = stringHash(attribute.name, hash);
hash = stringHash(attribute.value, hash);
// IE fix
if (elt.attributes) {
for (var i = 0; i < elt.attributes.length; i++) {
var attribute = elt.attributes[i];
if(attribute.value){ // only include attributes w/ actual values (empty is same as non-existent)
hash = stringHash(attribute.name, hash);
hash = stringHash(attribute.value, hash);
}
}
}
return hash;
Expand Down
2 changes: 1 addition & 1 deletion www/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,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]" integrity="sha384-+xCWLDahFW6be8O9igDEVbaW3NVXG8daKz3Z0L5tr1iy3AJIxx3CWEcXCZhTICnW" crossorigin="anonymous"></script>
<script src="https://unpkg.com/[email protected]" 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
13 changes: 8 additions & 5 deletions www/js/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -840,11 +840,14 @@ return (function () {

function attributeHash(elt) {
var hash = 0;
for (var i = 0; i < elt.attributes.length; i++) {
var attribute = elt.attributes[i];
if(attribute.value){ // only include attributes w/ actual values (empty is same as non-existent)
hash = stringHash(attribute.name, hash);
hash = stringHash(attribute.value, hash);
// IE fix
if (elt.attributes) {
for (var i = 0; i < elt.attributes.length; i++) {
var attribute = elt.attributes[i];
if(attribute.value){ // only include attributes w/ actual values (empty is same as non-existent)
hash = stringHash(attribute.name, hash);
hash = stringHash(attribute.value, hash);
}
}
}
return hash;
Expand Down
13 changes: 8 additions & 5 deletions www/test/1.8.5/src/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -840,11 +840,14 @@ return (function () {

function attributeHash(elt) {
var hash = 0;
for (var i = 0; i < elt.attributes.length; i++) {
var attribute = elt.attributes[i];
if(attribute.value){ // only include attributes w/ actual values (empty is same as non-existent)
hash = stringHash(attribute.name, hash);
hash = stringHash(attribute.value, hash);
// IE fix
if (elt.attributes) {
for (var i = 0; i < elt.attributes.length; i++) {
var attribute = elt.attributes[i];
if(attribute.value){ // only include attributes w/ actual values (empty is same as non-existent)
hash = stringHash(attribute.name, hash);
hash = stringHash(attribute.value, hash);
}
}
}
return hash;
Expand Down
43 changes: 33 additions & 10 deletions www/test/1.8.5/test/scratch/index.html

Large diffs are not rendered by default.

0 comments on commit 7ea35d0

Please sign in to comment.