From 0a4f3f624f1b0f3c19be855e084dfc8bb7abdc03 Mon Sep 17 00:00:00 2001 From: Johnny Shields Date: Wed, 22 Apr 2015 16:58:31 +0900 Subject: [PATCH] Fix Memory Leak: Remove all listeners when you destroy --- antiscroll.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/antiscroll.js b/antiscroll.js index 2de1812..e7789cb 100644 --- a/antiscroll.js +++ b/antiscroll.js @@ -163,6 +163,9 @@ Scrollbar.prototype.destroy = function () { this.el.remove(); + this.el.unbind('mousedown', this.mousedown); + this.pane.el.unbind('mouseenter', this.mouseenter); + this.pane.el.unbind('mouseleave', this.mouseleave); this.pane.inner.unbind('scroll', this.innerPaneScrollListener); this.pane.inner.unbind('mousewheel', this.innerPaneMouseWheelListener); return this;