Uncommend not working exit stream animation javascript code

This commit is contained in:
2024-09-14 13:07:54 +02:00
parent 3924b8f6f6
commit b306148120

View File

@@ -22,17 +22,17 @@ document.addEventListener("turbo:before-stream-render", function(event) {
// Add a class to an element we are about to remove from the page // Add a class to an element we are about to remove from the page
// as defined by its "data-stream-exit-class" // as defined by its "data-stream-exit-class"
var elementToRemove = document.getElementById(event.target.target) // var elementToRemove = document.getElementById(event.target.target)
if (elementToRemove) { // if (elementToRemove) {
var streamExitClass = elementToRemove.dataset.streamExitClass // var streamExitClass = elementToRemove.dataset.streamExitClass
if (streamExitClass) { // if (streamExitClass) {
// Intercept the removal of the element // // Intercept the removal of the element
event.preventDefault() // event.preventDefault()
elementToRemove.classList.add(streamExitClass) // elementToRemove.classList.add(streamExitClass)
// Wait for its animation to end before removing the element // // Wait for its animation to end before removing the element
elementToRemove.addEventListener("animationend", function() { // elementToRemove.addEventListener("animationend", function() {
event.target.performAction() // event.target.performAction()
}) // })
} // }
} // }
}) })