Skip to content

Commit

Permalink
Jquery cached data allocated by selectized is now cleaned up at destr…
Browse files Browse the repository at this point in the history
…oy time
  • Loading branch information
Scottmitch committed May 23, 2014
1 parent 6caddcc commit 930c5e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/selectize.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,8 @@ $.fn.selectize = function(settings_user) {
}

instance = new Selectize($input, $.extend(true, {}, defaults, settings_element, settings_user));
$input.data('selectize', instance);
$input.addClass('selectized');
});
};

$.fn.selectize.defaults = Selectize.defaults;
$.fn.selectize.defaults = Selectize.defaults;
5 changes: 5 additions & 0 deletions src/selectize.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ $.extend(Selectize.prototype, {
if (settings.preload === true) {
self.onSearchChange('');
}

$input.data('selectize', self);
},

/**
Expand Down Expand Up @@ -1830,6 +1832,9 @@ $.extend(Selectize.prototype, {
.attr({tabindex: revertSettings.tabindex})
.show();

self.$control_input.removeData('grow');
self.$input.removeData('selectize');

$(window).off(eventNS);
$(document).off(eventNS);
$(document.body).off(eventNS);
Expand Down

0 comments on commit 930c5e6

Please sign in to comment.