Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct hx-verb leaving behind empty class attributes on elements #2683

Open
wants to merge 13 commits into
base: dev
Choose a base branch
from
Open
5,132 changes: 0 additions & 5,132 deletions dist/htmx.amd.js

This file was deleted.

5,130 changes: 0 additions & 5,130 deletions dist/htmx.cjs.js

This file was deleted.

5,130 changes: 0 additions & 5,130 deletions dist/htmx.esm.js

This file was deleted.

5,129 changes: 0 additions & 5,129 deletions dist/htmx.js

This file was deleted.

12 changes: 6 additions & 6 deletions src/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -1892,10 +1892,10 @@ var htmx = (function() {
}
}

target.classList.remove(htmx.config.swappingClass)
removeClassFromElement(target, htmx.config.swappingClass)
forEach(settleInfo.elts, function(elt) {
if (elt.classList) {
elt.classList.add(htmx.config.settlingClass)
addClassToElement(elt, htmx.config.settlingClass)
}
triggerEvent(elt, 'htmx:afterSwap', swapOptions.eventInfo)
})
Expand All @@ -1915,7 +1915,7 @@ var htmx = (function() {
})
forEach(settleInfo.elts, function(elt) {
if (elt.classList) {
elt.classList.remove(htmx.config.settlingClass)
removeClassFromElement(elt, htmx.config.settlingClass)
}
triggerEvent(elt, 'htmx:afterSettle', swapOptions.eventInfo)
})
Expand Down Expand Up @@ -3194,7 +3194,7 @@ var htmx = (function() {
forEach(indicators, function(ic) {
const internalData = getInternalData(ic)
internalData.requestCount = (internalData.requestCount || 0) + 1
ic.classList.add.call(ic.classList, htmx.config.requestClass)
addClassToElement(ic, htmx.config.requestClass) // not sure why original used .call
})
return indicators
}
Expand Down Expand Up @@ -3225,7 +3225,7 @@ var htmx = (function() {
const internalData = getInternalData(ic)
internalData.requestCount = (internalData.requestCount || 0) - 1
if (internalData.requestCount === 0) {
ic.classList.remove.call(ic.classList, htmx.config.requestClass)
removeClassFromElement(ic, htmx.config.requestClass) // not sure why original used .call
}
})
forEach(disabled, function(disabledElement) {
Expand Down Expand Up @@ -4675,7 +4675,7 @@ var htmx = (function() {
swapSpec.ignoreTitle = ignoreTitle
}

target.classList.add(htmx.config.swappingClass)
addClassToElement(target, htmx.config.swappingClass)

// optional transition API promise callbacks
let settleResolve = null
Expand Down
2 changes: 1 addition & 1 deletion www/content/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Note that using a [meta tag](@/docs.md#config) is the preferred mechanism for se
* `getCacheBusterParam:false` - boolean: if set to true htmx will append the target element to the `GET` request in the format `org.htmx.cache-buster=targetElementId`
* `globalViewTransitions:false` - boolean: if set to `true`, htmx will use the [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) API when swapping in new content.
* `methodsThatUseUrlParams:["get"]` - array of strings: htmx will format requests with these methods by encoding their parameters in the URL, not the request body
* `selfRequestsOnly:false` - boolean: if set to `true` will only allow AJAX requests to the same domain as the current document
* `selfRequestsOnly:true` - boolean: whether to only allow AJAX requests to the same domain as the current document
* `ignoreTitle:false` - boolean: if set to `true` htmx will not update the title of the document when a `title` tag is found in new content
* `scrollIntoViewOnBoost:true` - boolean: whether or not the target of a boosted element is scrolled into the viewport. If `hx-target` is omitted on a boosted element, the target defaults to `body`, causing the page to scroll to the top.
* `triggerSpecsCache:null` - object: the cache to store evaluated trigger specifications into, improving parsing performance at the cost of more memory usage. You may define a simple object to use a never-clearing cache, or implement your own system using a [proxy object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Proxy) |
Expand Down
2 changes: 1 addition & 1 deletion www/content/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1650,7 +1650,7 @@ listed below:
| `htmx.config.getCacheBusterParam` | defaults to false, if set to true htmx will append the target element to the `GET` request in the format `org.htmx.cache-buster=targetElementId` |
| `htmx.config.globalViewTransitions` | if set to `true`, htmx will use the [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) API when swapping in new content. |
| `htmx.config.methodsThatUseUrlParams` | defaults to `["get"]`, htmx will format requests with these methods by encoding their parameters in the URL, not the request body |
| `htmx.config.selfRequestsOnly` | defaults to `false`, if set to `true` will only allow AJAX requests to the same domain as the current document |
| `htmx.config.selfRequestsOnly` | defaults to `true`, whether to only allow AJAX requests to the same domain as the current document |
| `htmx.config.ignoreTitle` | defaults to `false`, if set to `true` htmx will not update the title of the document when a `title` tag is found in new content |
| `htmx.config.disableInheritance` | disables attribute inheritance in htmx, which can then be overridden by the [`hx-inherit`](@/attributes/hx-inherit.md) attribute |
| `htmx.config.scrollIntoViewOnBoost` | defaults to `true`, whether or not the target of a boosted element is scrolled into the viewport. If `hx-target` is omitted on a boosted element, the target defaults to `body`, causing the page to scroll to the top. |
Expand Down
2 changes: 1 addition & 1 deletion www/content/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ listed below:
| `htmx.config.getCacheBusterParam` | defaults to false, if set to true htmx will append the target element to the `GET` request in the format `org.htmx.cache-buster=targetElementId` |
| `htmx.config.globalViewTransitions` | if set to `true`, htmx will use the [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) API when swapping in new content. |
| `htmx.config.methodsThatUseUrlParams` | defaults to `["get"]`, htmx will format requests with these methods by encoding their parameters in the URL, not the request body |
| `htmx.config.selfRequestsOnly` | defaults to `false`, if set to `true` will only allow AJAX requests to the same domain as the current document |
| `htmx.config.selfRequestsOnly` | defaults to `true`, whether to only allow AJAX requests to the same domain as the current document |
| `htmx.config.ignoreTitle` | defaults to `false`, if set to `true` htmx will not update the title of the document when a `title` tag is found in new content |
| `htmx.config.scrollIntoViewOnBoost` | defaults to `true`, whether or not the target of a boosted element is scrolled into the viewport. If `hx-target` is omitted on a boosted element, the target defaults to `body`, causing the page to scroll to the top. |
| `htmx.config.triggerSpecsCache` | defaults to `null`, the cache to store evaluated trigger specifications into, improving parsing performance at the cost of more memory usage. You may define a simple object to use a never-clearing cache, or implement your own system using a [proxy object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Proxy) |
Expand Down
6 changes: 6 additions & 0 deletions www/content/talk/podcasts.csv
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ Unfiltered Build - The HOWL stack is your new tech stack,https://podcast.unfilte
FrontendRheinMain - htmx: Building modern web applications without JS,https://www.youtube.com/watch?v=Jodkvyo5DbA
PodRocket by LogRocket,https://podrocket.logrocket.com/htmx-carson-gross
Backend Banter - Behind htmx: the re-Rise of Hypermedia,https://www.backendbanter.fm/episodes/024-behind-htmx-carson-gross-on-the-re-rise-of-hypermedia
JavaScript Jabber - What has Changed with htmx 2.0,https://topenddevs.com/podcasts/javascript-jabber/episodes/what-has-changed-with-htmx-2-0-with-carson-gross-jsj-604
Spiro Floropoulos,https://www.youtube.com/watch?v=xdaQ7de3W38
Software Unscripted - The Return of Hypermedia,https://shows.acast.com/software-unscripted/episodes/664fde448c77cc0013b3338c
ThePrimeTime - Creator of HTMX Talks HTMX,https://www.youtube.com/watch?v=LriHRa9t1fQ
Syntax - htmx Web Apps,https://syntax.fm/show/734/htmx-web-apps-with-carson-gross
PodRocket - htmx v2,https://podrocket.logrocket.com/htmx-v2-carson-gross
The Collab Lab - Hypermedia - Network Architecture Decoupling,https://www.youtube.com/watch?v=j1XXoeer320
TKYT,https://www.youtube.com/watch?v=JRfcR3MmxWQ
ThePrimeTime - So I Talked With Creator HTMX,https://www.youtube.com/watch?v=r8icH07gWBw