Skip to content

Commit

Permalink
fix (#4111)
Browse files Browse the repository at this point in the history
  • Loading branch information
calebporzio authored Mar 27, 2024
1 parent 137f8bb commit 628d51f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/alpinejs/src/directives/x-bind.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { applyBindingsObject, injectBindingProviders } from '../binds'

mapAttributes(startingWith(':', into(prefix('bind:'))))

let handler = (el, { value, modifiers, expression, original }, { effect }) => {
let handler = (el, { value, modifiers, expression, original }, { effect, cleanup }) => {
if (! value) {
let bindingProviders = {}
injectBindingProviders(bindingProviders)
Expand Down Expand Up @@ -36,6 +36,11 @@ let handler = (el, { value, modifiers, expression, original }, { effect }) => {

mutateDom(() => bind(el, value, result, modifiers))
}))

cleanup(() => {
el._x_undoAddedClasses && el._x_undoAddedClasses()
el._x_undoAddedStyles && el._x_undoAddedStyles()
})
}

// @todo: see if I can take advantage of the object created here inside the
Expand Down

0 comments on commit 628d51f

Please # to comment.