Skip to content

Commit

Permalink
[fix] fix event unbind bug on dom as [#42](#42)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
toxic-johann committed Nov 24, 2017
1 parent 9afae4a commit a139cb1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/dispatcher/dom.js
Expand Up @@ -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;
Expand Down

0 comments on commit a139cb1

Please sign in to comment.