mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Moves to a better delegate library
This commit is contained in:
parent
34c798851d
commit
1ac258dea5
2
dist/clipboard.min.js
vendored
2
dist/clipboard.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
||||
const ClipboardAction = require('./clipboard-action');
|
||||
const Delegate = require('dom-delegate').Delegate;
|
||||
const delegate = require('delegate-events');
|
||||
const Emitter = require('tiny-emitter');
|
||||
|
||||
/**
|
||||
@ -14,8 +14,7 @@ class Clipboard extends Emitter {
|
||||
constructor(selector) {
|
||||
super();
|
||||
|
||||
this.delegate = new Delegate(document.body);
|
||||
this.delegate.on('click', selector, (e) => this.initialize(e));
|
||||
delegate.bind(document.body, selector, 'click', (e) => this.initialize(e));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -28,10 +27,10 @@ class Clipboard extends Emitter {
|
||||
}
|
||||
|
||||
this.clipboardAction = new ClipboardAction({
|
||||
action : e.target.getAttribute('data-action'),
|
||||
target : e.target.getAttribute('data-target'),
|
||||
text : e.target.getAttribute('data-text'),
|
||||
trigger : e.target,
|
||||
action : e.delegateTarget.getAttribute('data-action'),
|
||||
target : e.delegateTarget.getAttribute('data-target'),
|
||||
text : e.delegateTarget.getAttribute('data-text'),
|
||||
trigger : e.delegateTarget,
|
||||
host : this
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user