1
0
mirror of synced 2025-02-04 06:09:23 +03:00

Fix memory leak in AttachBody

The `$dropdownContainer` variable wasn't being cleaned up when
Select2 was destroyed, which was causing a memory leak.

This closes https://github.com/select2/select2/issues/3559.
This closes https://github.com/select2/select2/pull/3603.
This commit is contained in:
Kevin Brown 2015-08-19 20:06:09 -04:00
parent 7bc9387de2
commit 671f5a2ce2

View File

@ -44,6 +44,12 @@ define([
});
};
AttachBody.prototype.destroy = function (decorated) {
decorated.call(this);
this.$dropdownContainer.remove();
};
AttachBody.prototype.position = function (decorated, $dropdown, $container) {
// Clone all of the container classes
$dropdown.attr('class', $container.attr('class'));