From 5e9482ef1c10e08d56fd4eed7f9cd6f6855e4bda Mon Sep 17 00:00:00 2001 From: txs1992 Date: Mon, 11 Mar 2019 20:37:01 +0800 Subject: [PATCH 1/3] fix: class array indexOf error --- dist/vue-clickaway.common.js | 2 +- dist/vue-clickaway.js | 4 ++-- dist/vue-clickaway.min.js | 2 +- index.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/vue-clickaway.common.js b/dist/vue-clickaway.common.js index 356e20f..5af9ec4 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 ? Array.from(path).indexOf(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..a132ed4 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 ? Array.from(path).indexOf(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..b42c390 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?Array.from(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 diff --git a/index.js b/index.js index bc362a3..329add5 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 ? Array.from(path).indexOf(el) < 0 : !el.contains(ev.target))) { return callback.call(vm, ev); } }; From bae88500a85b1ccefd50e921f5d871c378a3dd43 Mon Sep 17 00:00:00 2001 From: txs1992 Date: Tue, 12 Mar 2019 08:36:26 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat=EF=BC=9Achange=20to=20call=20function?= =?UTF-8?q?=20call.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/vue-clickaway.common.js | 2 +- dist/vue-clickaway.js | 2 +- dist/vue-clickaway.min.js | 2 +- index.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/vue-clickaway.common.js b/dist/vue-clickaway.common.js index 5af9ec4..e13c3df 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 ? Array.from(path).indexOf(el) < 0 : !el.contains(ev.target))) { + if (initialMacrotaskEnded && (path ? [].indexOf.call(path).indexOf(el) < 0 : !el.contains(ev.target))) { return callback.call(vm, ev); } }; diff --git a/dist/vue-clickaway.js b/dist/vue-clickaway.js index a132ed4..bf08ef8 100644 --- a/dist/vue-clickaway.js +++ b/dist/vue-clickaway.js @@ -51,7 +51,7 @@ // 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 ? Array.from(path).indexOf(el) < 0 : !el.contains(ev.target))) { + if (initialMacrotaskEnded && (path ? [].indexOf.call(path).indexOf(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 b42c390..fb12aaf 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?Array.from(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,n){"use strict";function t(e,n,t){i(e);var u=t.context,a=n.value;if("function"==typeof a){var c=!1;setTimeout(function(){c=!0},0),e[o]=function(n){var t=n.path||(n.composedPath?n.composedPath():void 0);if(c&&(t?[].indexOf.call(t).indexOf(e)<0:!e.contains(n.target)))return a.call(u,n)},document.documentElement.addEventListener("click",e[o],!1)}}function i(e){document.documentElement.removeEventListener("click",e[o],!1),delete e[o]}n="default"in n?n.default:n;/^2\./.test(n.version)||n.util.warn("VueClickaway 2.2.2 only supports Vue 2.x, and does not support Vue "+n.version);var o="_vue_clickaway_handler",u={bind:t,update:function(e,n){n.value!==n.oldValue&&t(e,n)},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 329add5..048fda9 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 ? Array.from(path).indexOf(el) < 0 : !el.contains(ev.target))) { + if (initialMacrotaskEnded && (path ? [].indexOf.call(path).indexOf(el) < 0 : !el.contains(ev.target))) { return callback.call(vm, ev); } }; From 78422be3be35dc80f6f36ff8573fd7fa46e9d376 Mon Sep 17 00:00:00 2001 From: txs1992 Date: Tue, 12 Mar 2019 08:38:08 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix=EF=BC=9Atype.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/vue-clickaway.common.js | 2 +- dist/vue-clickaway.js | 2 +- dist/vue-clickaway.min.js | 2 +- index.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/vue-clickaway.common.js b/dist/vue-clickaway.common.js index e13c3df..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 ? [].indexOf.call(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 bf08ef8..66ba779 100644 --- a/dist/vue-clickaway.js +++ b/dist/vue-clickaway.js @@ -51,7 +51,7 @@ // 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 ? [].indexOf.call(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 fb12aaf..aae4e65 100644 --- a/dist/vue-clickaway.min.js +++ b/dist/vue-clickaway.min.js @@ -1 +1 @@ -!function(e,n){"use strict";function t(e,n,t){i(e);var u=t.context,a=n.value;if("function"==typeof a){var c=!1;setTimeout(function(){c=!0},0),e[o]=function(n){var t=n.path||(n.composedPath?n.composedPath():void 0);if(c&&(t?[].indexOf.call(t).indexOf(e)<0:!e.contains(n.target)))return a.call(u,n)},document.documentElement.addEventListener("click",e[o],!1)}}function i(e){document.documentElement.removeEventListener("click",e[o],!1),delete e[o]}n="default"in n?n.default:n;/^2\./.test(n.version)||n.util.warn("VueClickaway 2.2.2 only supports Vue 2.x, and does not support Vue "+n.version);var o="_vue_clickaway_handler",u={bind:t,update:function(e,n){n.value!==n.oldValue&&t(e,n)},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 048fda9..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 ? [].indexOf.call(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); } };