Use a jquery event namespace(rivets-error-bind) to stop listening for
all element events at once.
Showing
1 changed file
with
2 additions
and
2 deletions
... | @@ -59,7 +59,7 @@ define(function(require) { | ... | @@ -59,7 +59,7 @@ define(function(require) { |
59 | } | 59 | } |
60 | } | 60 | } |
61 | }; | 61 | }; |
62 | $(el).on('focus', holder.focus).on('blur', holder.blur); | 62 | $(el).on('focus.rivets-error-binder', holder.focus).on('blur.rivets-error-binder', holder.blur); |
63 | rivetsBinderCall(this, this.args[0], 'bind', arguments); | 63 | rivetsBinderCall(this, this.args[0], 'bind', arguments); |
64 | render(el, 'bind'); | 64 | render(el, 'bind'); |
65 | }, | 65 | }, |
... | @@ -67,7 +67,7 @@ define(function(require) { | ... | @@ -67,7 +67,7 @@ define(function(require) { |
67 | var holder = this.validationHolder; | 67 | var holder = this.validationHolder; |
68 | render(el, 'unbind'); | 68 | render(el, 'unbind'); |
69 | $(this.validationHolder.marker).after(el).remove(); | 69 | $(this.validationHolder.marker).after(el).remove(); |
70 | $(el).off('focus', holder.focus).off('blur', holder.blur); | 70 | $(el).off('.rivets-error-binder'); |
71 | if (holder.observer.target) { | 71 | if (holder.observer.target) { |
72 | holder.observer.target.off('validated', holder.validated); | 72 | holder.observer.target.off('validated', holder.validated); |
73 | } | 73 | } | ... | ... |
-
Please register or sign in to post a comment