From a139cb17b878c4c298d88dd8a8798df473fe3525 Mon Sep 17 00:00:00 2001 From: toxic-johann <353904974@qq.com> Date: Fri, 24 Nov 2017 23:17:07 +0800 Subject: [PATCH] [fix] fix event unbind bug on dom as [#42](https://github.com/Chimeejs/chimee/issues/42) what: clear the domHandlerList when we unbind the function why: when destroy video, we forget to remove the function binding in the list, so the next time we remove video, it will throw error. --- src/dispatcher/dom.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/dispatcher/dom.js b/src/dispatcher/dom.js index 6515255..464aecd 100644 --- a/src/dispatcher/dom.js +++ b/src/dispatcher/dom.js @@ -157,9 +157,11 @@ export default class Dom { videoEvents.forEach((key, index) => { removeEvent(this.videoElement, key, this.videoEventHandlerList[index]); }); + this.videoEventHandlerList = []; domEvents.forEach((key, index) => { removeEvent(this.videoElement, key, this.videoDomEventHandlerList[index]); }); + this.videoDomEventHandlerList = []; $(videoElement).remove(); delete this.videoElement; return videoElement;