mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Throws an error if selector is empty
This commit is contained in:
@ -20,7 +20,12 @@ class Clipboard {
|
||||
// Methods
|
||||
|
||||
init() {
|
||||
[].forEach.call(this.triggers, (trigger) => this.bind(trigger));
|
||||
if (this.triggers.length > 0) {
|
||||
[].forEach.call(this.triggers, (trigger) => this.bind(trigger));
|
||||
}
|
||||
else {
|
||||
throw new Error('The provided selector is empty');
|
||||
}
|
||||
}
|
||||
|
||||
bind(trigger) {
|
||||
@ -83,7 +88,6 @@ class Clipboard {
|
||||
window.getSelection().removeAllRanges();
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user