Skip to content

Commit b9baeaa

Browse files
committed
Release 2.2.0
1 parent 4163050 commit b9baeaa

File tree

8 files changed

+1860
-13
lines changed

8 files changed

+1860
-13
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [2.2.0] - 2018-04-08
2+
3+
### Changed
4+
- Refer to `event.path` instead of `element.contains(event.target)` for more reliable containment check (fixes #23), kudos to @jonobr1
5+
16
## [2.1.0] - 2016-11-24
27

38
### Changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ $ npm install vue-clickaway --save
2828
From CDN:
2929

3030
``` html
31-
<script src="https://cdn.rawgit.com/simplesmiler/vue-clickaway/2.1.0/dist/vue-clickaway.js"></script>
31+
<script src="https://cdn.rawgit.com/simplesmiler/vue-clickaway/2.2.0/dist/vue-clickaway.js"></script>
3232
<!-- OR -->
33-
<script src="https://cdn.rawgit.com/simplesmiler/vue-clickaway/2.1.0/dist/vue-clickaway.min.js"></script>
33+
<script src="https://cdn.rawgit.com/simplesmiler/vue-clickaway/2.2.0/dist/vue-clickaway.min.js"></script>
3434
```
3535

3636
## Usage

dist/vue-clickaway.common.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
var Vue = require('vue');
44
Vue = 'default' in Vue ? Vue['default'] : Vue;
55

6-
var version = '2.1.0';
6+
var version = '2.2.0';
77

88
var compatible = (/^2\./).test(Vue.version);
99
if (!compatible) {
@@ -44,9 +44,11 @@ function bind(el, binding) {
4444
}, 0);
4545

4646
el[HANDLER] = function(ev) {
47-
// @NOTE: IE 5.0+
48-
// @REFERENCE: https://developer.mozilla.org/en/docs/Web/API/Node/contains
49-
if (initialMacrotaskEnded && !el.contains(ev.target)) {
47+
// @NOTE: this test used to be `el.containts`, but `ev.path` is better,
48+
// because it tests whether the element was there at the time of
49+
// the click, not whether it is there now, that the event has arrived
50+
// to the top.
51+
if (initialMacrotaskEnded && ev.path.indexOf(el) < 0) {
5052
return callback(ev);
5153
}
5254
};

dist/vue-clickaway.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Vue = 'default' in Vue ? Vue['default'] : Vue;
44

5-
var version = '2.1.0';
5+
var version = '2.2.0';
66

77
var compatible = (/^2\./).test(Vue.version);
88
if (!compatible) {
@@ -43,9 +43,11 @@
4343
}, 0);
4444

4545
el[HANDLER] = function(ev) {
46-
// @NOTE: IE 5.0+
47-
// @REFERENCE: https://developer.mozilla.org/en/docs/Web/API/Node/contains
48-
if (initialMacrotaskEnded && !el.contains(ev.target)) {
46+
// @NOTE: this test used to be `el.containts`, but `ev.path` is better,
47+
// because it tests whether the element was there at the time of
48+
// the click, not whether it is there now, that the event has arrived
49+
// to the top.
50+
if (initialMacrotaskEnded && ev.path.indexOf(el) < 0) {
4951
return callback(ev);
5052
}
5153
};

dist/vue-clickaway.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Vue from 'vue';
22

3-
export var version = '2.1.0';
3+
export var version = '2.2.0';
44

55
var compatible = (/^2\./).test(Vue.version);
66
if (!compatible) {

0 commit comments

Comments
 (0)