Updates delegate package which now exposes e.delegateTarget property #120

This commit is contained in:
Zeno Rocha 2015-11-13 00:24:46 -08:00
parent 5efcdf2810
commit cb4301658c
3 changed files with 10 additions and 6 deletions

View File

@ -6,7 +6,9 @@
</head>
<body>
<!-- 1. Define some markup -->
<button id="btn" data-clipboard-text="1">Copy</button>
<div id="btn" data-clipboard-text="1">
<span>Copy</span>
</div>
<!-- 2. Include library -->
<script src="../dist/clipboard.min.js"></script>

View File

@ -11,7 +11,7 @@
"cut"
],
"dependencies": {
"good-listener": "^1.1.2",
"good-listener": "^1.1.4",
"select": "^1.0.4",
"tiny-emitter": "^1.0.0"
},

View File

@ -42,15 +42,17 @@ class Clipboard extends Emitter {
* @param {Event} e
*/
onClick(e) {
var trigger = e.delegateTarget || e.currentTarget;
if (this.clipboardAction) {
this.clipboardAction = null;
}
this.clipboardAction = new ClipboardAction({
action : this.action(e.currentTarget),
target : this.target(e.currentTarget),
text : this.text(e.currentTarget),
trigger : e.currentTarget,
action : this.action(trigger),
target : this.target(trigger),
text : this.text(trigger),
trigger : trigger,
emitter : this
});
}