Moves to a better delegate library

This commit is contained in:
Zeno Rocha 2015-09-24 22:23:15 -07:00
parent 34c798851d
commit 1ac258dea5
2 changed files with 7 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@ -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
}); });
} }