Skip to content

Commit 35035ca

Browse files
author
Matteo Smaila
committed
Applied changes as requested by MichaelWest22.
1 parent dce5fa1 commit 35035ca

1 file changed

Lines changed: 2 additions & 24 deletions

File tree

src/htmx.js

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,37 +1413,16 @@ var htmx = (function() {
14131413
* @param {Element} mergeFrom
14141414
*/
14151415
function cloneAttributes(mergeTo, mergeFrom) {
1416-
const mergeToAttributesCopy = []
1417-
for (const attribute of mergeTo.attributes) {
1418-
mergeToAttributesCopy.push(attribute)
1419-
}
1420-
1421-
const mergeFromAttributesCopy = []
1422-
for (const attribute of mergeFrom.attributes) {
1423-
mergeFromAttributesCopy.push(attribute)
1424-
}
1425-
1426-
const htmxClasses = []
1427-
for (const klass of mergeTo.classList) {
1428-
if (klass.startsWith('htmx-')) {
1429-
htmxClasses.push(klass)
1430-
}
1431-
}
1432-
1433-
forEach(mergeToAttributesCopy, function(attr) {
1416+
forEach(Array.from(mergeTo.attributes), function(attr) {
14341417
if (!mergeFrom.hasAttribute(attr.name) && shouldSettleAttribute(attr.name)) {
14351418
mergeTo.removeAttribute(attr.name)
14361419
}
14371420
})
1438-
forEach(mergeFromAttributesCopy, function(attr) {
1421+
forEach(mergeFrom.attributes, function(attr) {
14391422
if (shouldSettleAttribute(attr.name)) {
14401423
mergeTo.setAttribute(attr.name, attr.value)
14411424
}
14421425
})
1443-
1444-
for (const htmxClass of htmxClasses) {
1445-
mergeTo.classList.add(htmxClass)
1446-
}
14471426
}
14481427

14491428
/**
@@ -1989,7 +1968,6 @@ var htmx = (function() {
19891968
target.classList.remove(htmx.config.swappingClass)
19901969
forEach(settleInfo.elts, function(elt) {
19911970
if (elt.classList) {
1992-
elt.classList.remove(htmx.config.swappingClass)
19931971
elt.classList.add(htmx.config.settlingClass)
19941972
}
19951973
triggerEvent(elt, 'htmx:afterSwap', swapOptions.eventInfo)

0 commit comments

Comments
 (0)