Skip to content

Commit

Permalink
Merge pull request #1249 from jwh315/Fix#1151
Browse files Browse the repository at this point in the history
Fix for #1151
  • Loading branch information
j0k3r committed Nov 24, 2016
2 parents ea7b00b + 1aeec16 commit 34f070f
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/js/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,17 @@
win = this.base.options.contentWindow,
doc = this.base.options.ownerDocument;

targets = MediumEditor.util.isElement(targets) || [win, doc].indexOf(targets) > -1 ? [targets] : targets;

Array.prototype.forEach.call(targets, function (target) {
index = this.indexOfListener(target, event, listener, useCapture);
if (index !== -1) {
e = this.events.splice(index, 1)[0];
e[0].removeEventListener(e[1], e[2], e[3]);
}
}.bind(this));
if (targets !== null) {
targets = MediumEditor.util.isElement(targets) || [win, doc].indexOf(targets) > -1 ? [targets] : targets;

Array.prototype.forEach.call(targets, function (target) {
index = this.indexOfListener(target, event, listener, useCapture);
if (index !== -1) {
e = this.events.splice(index, 1)[0];
e[0].removeEventListener(e[1], e[2], e[3]);
}
}.bind(this));
}
},

indexOfListener: function (target, event, listener, useCapture) {
Expand Down

0 comments on commit 34f070f

Please sign in to comment.