Skip to content

Commit 9acc591

Browse files
authored
fix(staticMethods): fixing IE event bug (#569)
fixing currentTarget for static method global show (in IE)
1 parent 2ed7f6a commit 9acc591

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/decorators/staticMethods.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import CONSTANT from "../constant";
66
const dispatchGlobalEvent = (eventName, opts) => {
77
// Compatible with IE
88
// @see http://stackoverflow.com/questions/26596123/internet-explorer-9-10-11-event-constructor-doesnt-work
9+
// @see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
910
let event;
1011

1112
if (typeof window.CustomEvent === "function") {
@@ -52,10 +53,11 @@ export default function(target) {
5253

5354
target.prototype.globalShow = function(event) {
5455
if (this.mount) {
56+
const hasTarget =
57+
(event && event.detail && event.detail.target && true) || false;
5558
// Create a fake event, specific show will limit the type to `solid`
5659
// only `float` type cares e.clientX e.clientY
57-
const e = { currentTarget: event.detail.target };
58-
this.showTooltip(e, true);
60+
this.showTooltip({ currentTarget: hasTarget && event.detail.target }, true);
5961
}
6062
};
6163

0 commit comments

Comments
 (0)