From 4de705fd0f84846317c77d17e23d3b9da9fc6e80 Mon Sep 17 00:00:00 2001 From: Stephen Date: Wed, 3 Sep 2014 14:40:49 +1000 Subject: [PATCH 1/2] Make sure we remove all document listeners on dispose. --- src/js/slider.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/js/slider.js b/src/js/slider.js index d8f2eb02b0..cad1744604 100644 --- a/src/js/slider.js +++ b/src/js/slider.js @@ -34,6 +34,17 @@ vjs.Slider = vjs.Component.extend({ } }); +vjs.Slider.prototype.dispose = function() { + vjs.off(document, 'mousemove', this.boundEvents.move, false); + vjs.off(document, 'mouseup', this.boundEvents.end, false); + vjs.off(document, 'touchmove', this.boundEvents.move, false); + vjs.off(document, 'touchend', this.boundEvents.end, false); + + vjs.off(document, 'keyup', vjs.bind(this, this.onKeyPress)); + + vjs.Component.prototype.dispose(this); +}; + vjs.Slider.prototype.createEl = function(type, props) { props = props || {}; // Add the slider element class to all sub classes From 8673480aa472be68589f42f960a41c25eafff86b Mon Sep 17 00:00:00 2001 From: Stephen Date: Wed, 3 Sep 2014 16:56:12 +1000 Subject: [PATCH 2/2] Should be executed using call. --- src/js/slider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/slider.js b/src/js/slider.js index cad1744604..50236c9911 100644 --- a/src/js/slider.js +++ b/src/js/slider.js @@ -42,7 +42,7 @@ vjs.Slider.prototype.dispose = function() { vjs.off(document, 'keyup', vjs.bind(this, this.onKeyPress)); - vjs.Component.prototype.dispose(this); + vjs.Component.prototype.dispose.call(this); }; vjs.Slider.prototype.createEl = function(type, props) {