mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Fix bug that unable to remove fake event listener (#256)
* Fix bug that unable to remove fake event listener * Update dist
This commit is contained in:
parent
a4ab305297
commit
869c4e3219
12
dist/clipboard.js
vendored
12
dist/clipboard.js
vendored
@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* clipboard.js v1.5.10
|
||||
* clipboard.js v1.5.11
|
||||
* https://zenorocha.github.io/clipboard.js
|
||||
*
|
||||
* Licensed MIT © Zeno Rocha
|
||||
@ -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
|
||||
@ -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) {
|
||||
@ -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);
|
||||
|
8
dist/clipboard.min.js
vendored
8
dist/clipboard.min.js
vendored
File diff suppressed because one or more lines are too long
@ -49,7 +49,8 @@ class ClipboardAction {
|
||||
|
||||
this.removeFake();
|
||||
|
||||
this.fakeHandler = document.body.addEventListener('click', () => this.removeFake()) || true;
|
||||
this.fakeHandlerCallback = () => this.removeFake();
|
||||
this.fakeHandler = document.body.addEventListener('click', this.fakeHandlerCallback) || true;
|
||||
|
||||
this.fakeElem = document.createElement('textarea');
|
||||
// Prevent zooming on iOS
|
||||
@ -78,8 +79,9 @@ class ClipboardAction {
|
||||
*/
|
||||
removeFake() {
|
||||
if (this.fakeHandler) {
|
||||
document.body.removeEventListener('click');
|
||||
document.body.removeEventListener('click', this.fakeHandlerCallback);
|
||||
this.fakeHandler = null;
|
||||
this.fakeHandlerCallback = null;
|
||||
}
|
||||
|
||||
if (this.fakeElem) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user