Skip to content

Commit 628d51f

Browse files
authored
fix (#4111)
1 parent 137f8bb commit 628d51f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/alpinejs/src/directives/x-bind.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { applyBindingsObject, injectBindingProviders } from '../binds'
66

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

9-
let handler = (el, { value, modifiers, expression, original }, { effect }) => {
9+
let handler = (el, { value, modifiers, expression, original }, { effect, cleanup }) => {
1010
if (! value) {
1111
let bindingProviders = {}
1212
injectBindingProviders(bindingProviders)
@@ -36,6 +36,11 @@ let handler = (el, { value, modifiers, expression, original }, { effect }) => {
3636

3737
mutateDom(() => bind(el, value, result, modifiers))
3838
}))
39+
40+
cleanup(() => {
41+
el._x_undoAddedClasses && el._x_undoAddedClasses()
42+
el._x_undoAddedStyles && el._x_undoAddedStyles()
43+
})
3944
}
4045

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

0 commit comments

Comments
 (0)