From 9acc5919de80208da98893d9f2fc32bd0a261410 Mon Sep 17 00:00:00 2001 From: Jarch09 Date: Wed, 1 Apr 2020 23:30:44 -0400 Subject: [PATCH] fix(staticMethods): fixing IE event bug (#569) fixing currentTarget for static method global show (in IE) --- src/decorators/staticMethods.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/decorators/staticMethods.js b/src/decorators/staticMethods.js index ab6cc89ae..d68a70848 100755 --- a/src/decorators/staticMethods.js +++ b/src/decorators/staticMethods.js @@ -6,6 +6,7 @@ import CONSTANT from "../constant"; const dispatchGlobalEvent = (eventName, opts) => { // Compatible with IE // @see http://stackoverflow.com/questions/26596123/internet-explorer-9-10-11-event-constructor-doesnt-work + // @see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent let event; if (typeof window.CustomEvent === "function") { @@ -52,10 +53,11 @@ export default function(target) { target.prototype.globalShow = function(event) { if (this.mount) { + const hasTarget = + (event && event.detail && event.detail.target && true) || false; // Create a fake event, specific show will limit the type to `solid` // only `float` type cares e.clientX e.clientY - const e = { currentTarget: event.detail.target }; - this.showTooltip(e, true); + this.showTooltip({ currentTarget: hasTarget && event.detail.target }, true); } };