Skip to content

Commit

Permalink
Merge pull request #22 from peschee/patch-1
Browse files Browse the repository at this point in the history
Fix issues in IE11
  • Loading branch information
RobinCK authored Mar 14, 2018
2 parents 3d4efb3 + 78bc4bb commit 325e346
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
9 changes: 8 additions & 1 deletion dist/js/vue-popper.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ var VuePopper$1 = { render: function render() {
}, this.delayOnMouseOut);
},
handleDocumentClick: function handleDocumentClick(e) {
if (!this.$el || !this.referenceElm || this.$el.contains(e.target) || this.referenceElm.contains(e.target) || !this.popper || this.popper.contains(e.target)) {
if (!this.$el || !this.referenceElm || this.elementContains(this.$el, e.target) || this.elementContains(this.referenceElm, e.target) || !this.popper || this.elementContains(this.popper, e.target)) {
return;
}

Expand All @@ -378,6 +378,13 @@ var VuePopper$1 = { render: function render() {
}

this.showPopper = false;
},
elementContains: function elementContains(elm, otherElm) {
if (typeof elm.contains === 'function') {
return elm.contains(otherElm);
}

return false;
}
},

Expand Down
2 changes: 1 addition & 1 deletion dist/js/vue-popper.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions src/component/popper.js.vue
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@
handleDocumentClick(e) {
if (!this.$el || !this.referenceElm ||
this.$el.contains(e.target) ||
this.referenceElm.contains(e.target) ||
!this.popper || this.popper.contains(e.target)
this.elementContains(this.$el, e.target) ||
this.elementContains(this.referenceElm, e.target) ||
!this.popper || this.elementContains(this.popper, e.target)
) {
return;
}
Expand All @@ -328,6 +328,14 @@
}
this.showPopper = false;
},
elementContains(elm, otherElm) {
if (typeof elm.contains === 'function') {
return elm.contains(otherElm);
}
return false;
}
},
Expand Down

0 comments on commit 325e346

Please sign in to comment.