Skip to content

Commit

Permalink
fix: Don't use deprecated Event.path if composedPath() exists (#535)
Browse files Browse the repository at this point in the history
* fix: do not use deprecated Event.path if composedPath() exists

* chore: increment patch version
  • Loading branch information
soe-j authored May 16, 2022
1 parent 82b964f commit aa0ea11
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "v-click-outside",
"version": "3.1.2",
"version": "3.1.3",
"description": "Vue directive to react on clicks outside an element",
"main": "dist/v-click-outside.umd.js",
"umd:main": "dist/v-click-outside.umd.js",
Expand Down
2 changes: 1 addition & 1 deletion src/v-click-outside.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function onEvent({ el, event, handler, middleware }) {
// https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath
// In the meanwhile, we are using el.contains for those browsers, not
// the ideal solution, but using IE or EDGE is not ideal either.
const path = event.path || (event.composedPath && event.composedPath())
const path = (event.composedPath && event.composedPath()) || event.path
const isClickOutside = path
? path.indexOf(el) < 0
: !el.contains(event.target)
Expand Down

0 comments on commit aa0ea11

Please sign in to comment.