Skip to content

Commit bfc4517

Browse files
committed
Call callback with proper context
1 parent 289d967 commit bfc4517

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ if (!compatible) {
1313

1414
var HANDLER = '_vue_clickaway_handler';
1515

16-
function bind(el, binding) {
16+
function bind(el, binding, vnode) {
1717
unbind(el);
1818

19+
var vm = vnode.context;
20+
1921
var callback = binding.value;
2022
if (typeof callback !== 'function') {
2123
if (process.env.NODE_ENV !== 'production') {
@@ -48,7 +50,7 @@ function bind(el, binding) {
4850
// @NOTE: `.path` is non-standard, the standard way is `.composedPath()`
4951
var path = ev.path || (ev.composedPath ? ev.composedPath() : undefined);
5052
if (initialMacrotaskEnded && (path ? path.indexOf(el) < 0 : !el.contains(ev.target))) {
51-
return callback(ev);
53+
return callback.call(vm, ev);
5254
}
5355
};
5456

0 commit comments

Comments
 (0)