diff --git a/dist/vue-clickaway.common.js b/dist/vue-clickaway.common.js index 356e20f..bc4994a 100644 --- a/dist/vue-clickaway.common.js +++ b/dist/vue-clickaway.common.js @@ -52,7 +52,7 @@ function bind(el, binding, vnode) { // to the top. // @NOTE: `.path` is non-standard, the standard way is `.composedPath()` var path = ev.path || (ev.composedPath ? ev.composedPath() : undefined); - if (initialMacrotaskEnded && (path ? path.indexOf(el) < 0 : !el.contains(ev.target))) { + if (initialMacrotaskEnded && (path ? [].indexOf.call(path, el) < 0 : !el.contains(ev.target))) { return callback.call(vm, ev); } }; diff --git a/dist/vue-clickaway.js b/dist/vue-clickaway.js index f2a90a4..66ba779 100644 --- a/dist/vue-clickaway.js +++ b/dist/vue-clickaway.js @@ -45,13 +45,13 @@ }, 0); el[HANDLER] = function(ev) { - // @NOTE: this test used to be just `el.contains`, but working with path is better, + // @NOTE: this test used to be just `el.containts`, but working with path is better, // because it tests whether the element was there at the time of // the click, not whether it is there now, that the event has arrived // to the top. // @NOTE: `.path` is non-standard, the standard way is `.composedPath()` var path = ev.path || (ev.composedPath ? ev.composedPath() : undefined); - if (initialMacrotaskEnded && (path ? path.indexOf(el) < 0 : !el.contains(ev.target))) { + if (initialMacrotaskEnded && (path ? [].indexOf.call(path, el) < 0 : !el.contains(ev.target))) { return callback.call(vm, ev); } }; diff --git a/dist/vue-clickaway.min.js b/dist/vue-clickaway.min.js index dace22a..aae4e65 100644 --- a/dist/vue-clickaway.min.js +++ b/dist/vue-clickaway.min.js @@ -1 +1 @@ -!function(e,t){"use strict";function n(e,t,n){i(e);var u=n.context,a=t.value;if("function"==typeof a){var c=!1;setTimeout(function(){c=!0},0),e[o]=function(t){var n=t.path||(t.composedPath?t.composedPath():void 0);if(c&&(n?n.indexOf(e)<0:!e.contains(t.target)))return a.call(u,t)},document.documentElement.addEventListener("click",e[o],!1)}}function i(e){document.documentElement.removeEventListener("click",e[o],!1),delete e[o]}t="default"in t?t.default:t;/^2\./.test(t.version)||t.util.warn("VueClickaway 2.2.2 only supports Vue 2.x, and does not support Vue "+t.version);var o="_vue_clickaway_handler",u={bind:n,update:function(e,t){t.value!==t.oldValue&&n(e,t)},unbind:i},a={directives:{onClickaway:u}};e.version="2.2.2",e.directive=u,e.mixin=a}(this.VueClickaway={},Vue); \ No newline at end of file +!function(e,t){"use strict";function n(e,t,n){i(e);var u=n.context,a=t.value;if("function"==typeof a){var c=!1;setTimeout(function(){c=!0},0),e[o]=function(t){var n=t.path||(t.composedPath?t.composedPath():void 0);if(c&&(n?[].indexOf.call(n,e)<0:!e.contains(t.target)))return a.call(u,t)},document.documentElement.addEventListener("click",e[o],!1)}}function i(e){document.documentElement.removeEventListener("click",e[o],!1),delete e[o]}t="default"in t?t.default:t;/^2\./.test(t.version)||t.util.warn("VueClickaway 2.2.2 only supports Vue 2.x, and does not support Vue "+t.version);var o="_vue_clickaway_handler",u={bind:n,update:function(e,t){t.value!==t.oldValue&&n(e,t)},unbind:i},a={directives:{onClickaway:u}};e.version="2.2.2",e.directive=u,e.mixin=a}(this.VueClickaway={},Vue); \ No newline at end of file diff --git a/index.js b/index.js index bc362a3..86a85f4 100644 --- a/index.js +++ b/index.js @@ -49,7 +49,7 @@ function bind(el, binding, vnode) { // to the top. // @NOTE: `.path` is non-standard, the standard way is `.composedPath()` var path = ev.path || (ev.composedPath ? ev.composedPath() : undefined); - if (initialMacrotaskEnded && (path ? path.indexOf(el) < 0 : !el.contains(ev.target))) { + if (initialMacrotaskEnded && (path ? [].indexOf.call(path, el) < 0 : !el.contains(ev.target))) { return callback.call(vm, ev); } };