Skip to content

Commit

Permalink
firefox double exec fix fml
Browse files Browse the repository at this point in the history
  • Loading branch information
1cg committed Mar 15, 2024
1 parent 3205e65 commit ea3beb6
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 33 deletions.
15 changes: 7 additions & 8 deletions dist/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ return (function () {
if (htmx.config.inlineScriptNonce) {
script.nonce = htmx.config.inlineScriptNonce;
}
getInternalData(script).executed = true; // mark as executed due to template insertion semantics
// mark as executed due to template insertion semantics on all browsers except firefox fml
getInternalData(script).executed = navigator.userAgent.indexOf("Firefox") === -1;
})
} else {
forEach(fragment.querySelectorAll("script"), function (script) {
Expand Down Expand Up @@ -1933,14 +1934,12 @@ return (function () {
}

function processScripts(elt) {
if (!htmx.config.useTemplateFragments) {
if (matches(elt, "script")) {
evalScript(elt);
}
forEach(findAll(elt, "script"), function (script) {
evalScript(script);
});
if (matches(elt, "script")) {
evalScript(elt);
}
forEach(findAll(elt, "script"), function (script) {
evalScript(script);
});
}

function shouldProcessHxOn(elt) {
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.
15 changes: 7 additions & 8 deletions src/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ return (function () {
if (htmx.config.inlineScriptNonce) {
script.nonce = htmx.config.inlineScriptNonce;
}
getInternalData(script).executed = true; // mark as executed due to template insertion semantics
// mark as executed due to template insertion semantics on all browsers except firefox fml
getInternalData(script).executed = navigator.userAgent.indexOf("Firefox") === -1;
})
} else {
forEach(fragment.querySelectorAll("script"), function (script) {
Expand Down Expand Up @@ -1933,14 +1934,12 @@ return (function () {
}

function processScripts(elt) {
if (!htmx.config.useTemplateFragments) {
if (matches(elt, "script")) {
evalScript(elt);
}
forEach(findAll(elt, "script"), function (script) {
evalScript(script);
});
if (matches(elt, "script")) {
evalScript(elt);
}
forEach(findAll(elt, "script"), function (script) {
evalScript(script);
});
}

function shouldProcessHxOn(elt) {
Expand Down
15 changes: 7 additions & 8 deletions www/static/src/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ return (function () {
if (htmx.config.inlineScriptNonce) {
script.nonce = htmx.config.inlineScriptNonce;
}
getInternalData(script).executed = true; // mark as executed due to template insertion semantics
// mark as executed due to template insertion semantics on all browsers except firefox fml
getInternalData(script).executed = navigator.userAgent.indexOf("Firefox") === -1;
})
} else {
forEach(fragment.querySelectorAll("script"), function (script) {
Expand Down Expand Up @@ -1933,14 +1934,12 @@ return (function () {
}

function processScripts(elt) {
if (!htmx.config.useTemplateFragments) {
if (matches(elt, "script")) {
evalScript(elt);
}
forEach(findAll(elt, "script"), function (script) {
evalScript(script);
});
if (matches(elt, "script")) {
evalScript(elt);
}
forEach(findAll(elt, "script"), function (script) {
evalScript(script);
});
}

function shouldProcessHxOn(elt) {
Expand Down
15 changes: 7 additions & 8 deletions www/themes/htmx-theme/static/js/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ return (function () {
if (htmx.config.inlineScriptNonce) {
script.nonce = htmx.config.inlineScriptNonce;
}
getInternalData(script).executed = true; // mark as executed due to template insertion semantics
// mark as executed due to template insertion semantics on all browsers except firefox fml
getInternalData(script).executed = navigator.userAgent.indexOf("Firefox") === -1;
})
} else {
forEach(fragment.querySelectorAll("script"), function (script) {
Expand Down Expand Up @@ -1933,14 +1934,12 @@ return (function () {
}

function processScripts(elt) {
if (!htmx.config.useTemplateFragments) {
if (matches(elt, "script")) {
evalScript(elt);
}
forEach(findAll(elt, "script"), function (script) {
evalScript(script);
});
if (matches(elt, "script")) {
evalScript(elt);
}
forEach(findAll(elt, "script"), function (script) {
evalScript(script);
});
}

function shouldProcessHxOn(elt) {
Expand Down

0 comments on commit ea3beb6

Please sign in to comment.