summaryrefslogtreecommitdiffstatshomepage
path: root/src/htmx.js
diff options
context:
space:
mode:
authorCarson Gross <carson@bigsky.software>2024-01-23 12:53:58 -0700
committerCarson Gross <carson@bigsky.software>2024-01-23 12:53:58 -0700
commitfd775f84bec3a6bf2d67de491426c8217b63dab8 (patch)
treea53bdf0b22ef62f33c82416dce7f8fcc45003d6d /src/htmx.js
parentb32925937c38ca3a21b208cca13f07f33cd9a8cb (diff)
downloadhtmx-fd775f84bec3a6bf2d67de491426c8217b63dab8.tar.gz
htmx-fd775f84bec3a6bf2d67de491426c8217b63dab8.zip
fix version and lint
Diffstat (limited to 'src/htmx.js')
-rw-r--r--src/htmx.js44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/htmx.js b/src/htmx.js
index 6a2cceab..8cbe55f9 100644
--- a/src/htmx.js
+++ b/src/htmx.js
@@ -299,7 +299,7 @@ var htmx = (function() {
const head = (HEAD_TAG_REGEX.exec(response) || [''])[0]
const responseWithNoHead = response.replace(HEAD_TAG_REGEX, '')
const startTag = getStartTag(responseWithNoHead)
- let fragment = null;
+ let fragment = null
if (startTag === 'html') {
// if it is a full document, parse it and return the body
fragment = new DocumentFragment()
@@ -333,14 +333,14 @@ var htmx = (function() {
if (htmx.config.allowScriptTags) {
// if there is a nonce set up, set it on the new script tags
if (htmx.config.inlineScriptNonce) {
- fragment.querySelectorAll("script").forEach((script) => script.nonce = htmx.config.inlineScriptNonce);
+ fragment.querySelectorAll('script').forEach((script) => script.nonce = htmx.config.inlineScriptNonce)
}
} else {
// remove all script tags if scripts are disabled
- fragment.querySelectorAll("script").forEach((script) => script.remove());
+ fragment.querySelectorAll('script').forEach((script) => script.remove())
}
}
- return fragment;
+ return fragment
}
/**
@@ -919,7 +919,7 @@ var htmx = (function() {
handleAttributes(parentNode, fragment, settleInfo)
while (fragment.childNodes.length > 0) {
const child = fragment.firstChild
- addClassToElement(child, htmx.config.addedClass);
+ addClassToElement(child, htmx.config.addedClass)
parentNode.insertBefore(child, insertBefore)
if (child.nodeType !== Node.TEXT_NODE && child.nodeType !== Node.COMMENT_NODE) {
settleInfo.tasks.push(makeAjaxLoadTask(child))
@@ -3890,30 +3890,30 @@ var htmx = (function() {
return getExtensions(parentElt(elt), extensionsToReturn, extensionsToIgnore)
}
- //====================================================================
- // Initialization
- //====================================================================
- var isReady = false
- getDocument().addEventListener('DOMContentLoaded', function() {
- isReady = true
- })
+ //= ===================================================================
+ // Initialization
+ //= ===================================================================
+ var isReady = false
+ getDocument().addEventListener('DOMContentLoaded', function() {
+ isReady = true
+ })
- /**
+ /**
* Execute a function now if DOMContentLoaded has fired, otherwise listen for it.
*
* This function uses isReady because there is no realiable way to ask the browswer whether
* the DOMContentLoaded event has already been fired; there's a gap between DOMContentLoaded
* firing and readystate=complete.
*/
- function ready(fn) {
- // Checking readyState here is a failsafe in case the htmx script tag entered the DOM by
- // some means other than the initial page load.
- if (isReady || getDocument().readyState === 'complete') {
- fn();
- } else {
- getDocument().addEventListener('DOMContentLoaded', fn);
- }
- }
+ function ready(fn) {
+ // Checking readyState here is a failsafe in case the htmx script tag entered the DOM by
+ // some means other than the initial page load.
+ if (isReady || getDocument().readyState === 'complete') {
+ fn()
+ } else {
+ getDocument().addEventListener('DOMContentLoaded', fn)
+ }
+ }
function insertIndicatorStyles() {
if (htmx.config.includeIndicatorStyles !== false) {