From 6be3d737af6b937a55015fed9a4721be1d875ba4 Mon Sep 17 00:00:00 2001 From: Carson Gross Date: Thu, 25 Jan 2024 21:06:35 -0700 Subject: [PATCH] pain --- src/htmx.js | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/src/htmx.js b/src/htmx.js index 6afb24cd..1e09da10 100644 --- a/src/htmx.js +++ b/src/htmx.js @@ -289,22 +289,31 @@ var htmx = (function() { } } + function duplicateScript(script) { + const newScript = getDocument().createElement('script') + forEach(script.attributes, function (attr) { + newScript.setAttribute(attr.name, attr.value) + }) + newScript.textContent = script.textContent + newScript.async = false + if (htmx.config.inlineScriptNonce) { + newScript.nonce = htmx.config.inlineScriptNonce + } + return newScript; + } + + function isJavaScriptScriptNode(script) { + return script.matches('script') && (script.type === 'text/javascript' || script.type === 'module' || script.type === ''); + } + // we have to make new copies of script tags that we are going to insert because // SOME browsers (not saying who, but it involves an element and an animal) don't // execute scripts created in