From d93bea98d7522372a871d997bbd606d65659a4f9 Mon Sep 17 00:00:00 2001 From: Stephen Date: Mon, 29 Sep 2014 15:54:52 -0700 Subject: [PATCH] @mynameisstephen fixed an issue where slider event listeners were not cleaned up. closes #1475 --- CHANGELOG.md | 1 + src/js/slider.js | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b35498225..21a6ecce5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG ## HEAD (Unreleased) * @deedos added a Brazilian Portuguese translation ([view](https://github.com/videojs/video.js/pull/1520)) * @baloneysandwiches added a hasClass method ([view](https://github.com/videojs/video.js/pull/1464)) +* @mynameisstephen fixed an issue where slider event listeners were not being cleaned up ([view](https://github.com/videojs/video.js/pull/1475)) -------------------- diff --git a/src/js/slider.js b/src/js/slider.js index d8f2eb02b..50236c991 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.call(this); +}; + vjs.Slider.prototype.createEl = function(type, props) { props = props || {}; // Add the slider element class to all sub classes