Skip to content

Commit

Permalink
unbind events on destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
aehlke committed Oct 12, 2013
1 parent bd5bb36 commit 9008887
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
9 changes: 7 additions & 2 deletions js/tag-it.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,9 @@
// while tagSource is left null by default.
autocompleteOptions.source = this.options.tagSource || autocompleteOptions.source;

this.tagInput.autocomplete(autocompleteOptions).bind('autocompleteopen', function(event, ui) {
this.tagInput.autocomplete(autocompleteOptions).bind('autocompleteopen.tagit', function(event, ui) {
that.tagInput.data('autocomplete-open', true);
}).bind('autocompleteclose', function(event, ui) {
}).bind('autocompleteclose.tagit', function(event, ui) {
that.tagInput.data('autocomplete-open', false)
});
}
Expand All @@ -305,6 +305,11 @@
destroy: function() {
$.Widget.prototype.destroy.call(this);

this.element.unbind('.tagit');
this.tagList.unbind('.tagit');

this.tagInput.removeData('autocomplete-open');

this.tagList.removeClass([
'tagit',
'ui-widget',
Expand Down
12 changes: 6 additions & 6 deletions js/tag-it.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9008887

Please sign in to comment.