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 ClipboardAction = require('./clipboard-action');
|
||||||
const Delegate = require('dom-delegate').Delegate;
|
const delegate = require('delegate-events');
|
||||||
const Emitter = require('tiny-emitter');
|
const Emitter = require('tiny-emitter');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14,8 +14,7 @@ class Clipboard extends Emitter {
|
|||||||
constructor(selector) {
|
constructor(selector) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.delegate = new Delegate(document.body);
|
delegate.bind(document.body, selector, 'click', (e) => this.initialize(e));
|
||||||
this.delegate.on('click', selector, (e) => this.initialize(e));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,10 +27,10 @@ class Clipboard extends Emitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.clipboardAction = new ClipboardAction({
|
this.clipboardAction = new ClipboardAction({
|
||||||
action : e.target.getAttribute('data-action'),
|
action : e.delegateTarget.getAttribute('data-action'),
|
||||||
target : e.target.getAttribute('data-target'),
|
target : e.delegateTarget.getAttribute('data-target'),
|
||||||
text : e.target.getAttribute('data-text'),
|
text : e.delegateTarget.getAttribute('data-text'),
|
||||||
trigger : e.target,
|
trigger : e.delegateTarget,
|
||||||
host : this
|
host : this
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user