Skip to content

Commit 24ac202

Browse files
committed
Merge pull request #496 from liazy/master
Fix memory leaks.
2 parents af90b49 + 0518b12 commit 24ac202

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/jquery.multiselect.filter.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
var _self = this;
6464

6565
// do not include hidden elems if the menu isn't open.
66-
var selector = instance._isOpen ? ':disabled, :hidden' : ':disabled';
66+
var selector = _self._isOpen ? ':disabled, :hidden' : ':disabled';
6767

6868
$inputs = $inputs
6969
.not(selector)
@@ -91,14 +91,14 @@
9191
};
9292

9393
// rebuild cache when multiselect is updated
94-
var doc = $(document).bind('multiselectrefresh', $.proxy(function() {
94+
var doc = $(document).bind('multiselectrefresh.'+ instance._namespaceID, $.proxy(function() {
9595
this.updateCache();
9696
this._handler();
9797
}, this));
9898

9999
// automatically reset the widget on close?
100100
if(this.options.autoReset) {
101-
doc.bind('multiselectclose', $.proxy(this._reset, this));
101+
doc.bind('multiselectclose.'+ instance._namespaceID, $.proxy(this._reset, this));
102102
}
103103
},
104104

src/jquery.multiselect.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@
434434
// restored to their defaultValue prop on form reset, and the reset
435435
// handler fires before the form is actually reset. delaying it a bit
436436
// gives the form inputs time to clear.
437-
$(this.element[0].form).bind('reset.multiselect', function() {
437+
$(this.element[0].form).bind('reset.' + this._namespaceID, function() {
438438
setTimeout($.proxy(self.refresh, self), 10);
439439
});
440440
},
@@ -666,6 +666,7 @@
666666

667667
// unbind events
668668
$doc.unbind(this._namespaceID);
669+
$(this.element[0].form).unbind(this._namespaceID);
669670

670671
this.button.remove();
671672
this.menu.remove();

0 commit comments

Comments
 (0)