Skip to content

Commit

Permalink
Fix bug that unable to remove fake event listener (#256)
Browse files Browse the repository at this point in the history
* Fix bug that unable to remove fake event listener

* Update dist
  • Loading branch information
DrA1ex authored and zenorocha committed Jun 9, 2016
1 parent a4ab305 commit 869c4e3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
12 changes: 7 additions & 5 deletions dist/clipboard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* clipboard.js v1.5.10
* clipboard.js v1.5.11
* https://zenorocha.github.io/clipboard.js
*
* Licensed MIT © Zeno Rocha
Expand Down Expand Up @@ -448,9 +448,10 @@ module.exports = E;

this.removeFake();

this.fakeHandler = document.body.addEventListener('click', function () {
this.fakeHandlerCallback = function () {
return _this.removeFake();
}) || true;
};
this.fakeHandler = document.body.addEventListener('click', this.fakeHandlerCallback) || true;

this.fakeElem = document.createElement('textarea');
// Prevent zooming on iOS
Expand All @@ -475,8 +476,9 @@ module.exports = E;

ClipboardAction.prototype.removeFake = function removeFake() {
if (this.fakeHandler) {
document.body.removeEventListener('click');
document.body.removeEventListener('click', this.fakeHandlerCallback);
this.fakeHandler = null;
this.fakeHandlerCallback = null;
}

if (this.fakeElem) {
Expand All @@ -491,7 +493,7 @@ module.exports = E;
};

ClipboardAction.prototype.copyText = function copyText() {
var succeeded = undefined;
var succeeded = void 0;

try {
succeeded = document.execCommand(this.action);
Expand Down
Loading

0 comments on commit 869c4e3

Please sign in to comment.