diff --git a/src/directives/on.ts b/src/directives/on.ts index efefcaf..b09e50f 100644 --- a/src/directives/on.ts +++ b/src/directives/on.ts @@ -78,4 +78,8 @@ export const on: Directive = ({ el, get, exp, arg, modifiers }) => { } listen(el, arg, handler, modifiers) + + return () => { + el.removeEventListener(arg!, handler, modifiers) + } } diff --git a/tests/model.html b/tests/model.html index 886d1a2..3942c7e 100644 --- a/tests/model.html +++ b/tests/model.html @@ -22,6 +22,10 @@