From ae32eb13aa411fa52176fef1d13060efbeb43c0d Mon Sep 17 00:00:00 2001 From: Nicolaj Egelund Date: Sun, 12 Mar 2017 17:33:12 +0100 Subject: [PATCH] Moved mousedown event parameter in function and fixed wrongly placed parentheses --- src/utils/clickoutside.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/utils/clickoutside.js b/src/utils/clickoutside.js index 11236d2e..5da0b7d3 100644 --- a/src/utils/clickoutside.js +++ b/src/utils/clickoutside.js @@ -9,7 +9,7 @@ let startClick; !Vue.prototype.$isServer && on(document, 'mousedown', e => (startClick = e)); !Vue.prototype.$isServer && on(document, 'mouseup', e => { - nodeList.forEach(node => node[ctx].documentHandler(e)); + nodeList.forEach(node => node[ctx].documentHandler(e, startClick)); }); /** * v-clickoutside @@ -22,13 +22,12 @@ let startClick; export default { bind(el, binding, vnode) { const id = nodeList.push(el) - 1; - const documentHandler = function(e) { + const documentHandler = function(mouseup, mousedown) { if (!vnode.context || - el.contains(e.target) || - el.contains(startClick.target) || + el.contains(mouseup.target) || (vnode.context.popperElm && - (vnode.context.popperElm.contains(e.target)) || - vnode.context.popperElm.contains(startClick.target))) return; + (vnode.context.popperElm.contains(mouseup.target) || + vnode.context.popperElm.contains(mousedown.target)))) return; if (binding.expression && el[ctx].methodName &&