From b7eb537d1de992a43a4d2fecb0a1115a78c3b1be Mon Sep 17 00:00:00 2001 From: Mikhail Bashkirov Date: Fri, 12 Jul 2019 15:52:28 +0200 Subject: [PATCH] fix(button): make redispatch method protected --- packages/button/src/LionButton.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/button/src/LionButton.js b/packages/button/src/LionButton.js index dc49ef5b3..196b48008 100644 --- a/packages/button/src/LionButton.js +++ b/packages/button/src/LionButton.js @@ -152,17 +152,21 @@ export class LionButton extends DelegateMixin(SlotMixin(LionLitElement)) { this.__teardownDelegation(); } - /** - * Prevent click on the fake element and cause click on the native button. - */ - __clickDelegationHandler(oldEvent) { - oldEvent.stopPropagation(); + _redispatchClickEvent(oldEvent) { // replacing `MouseEvent` with `oldEvent.constructor` breaks IE const newEvent = new MouseEvent(oldEvent.type, oldEvent); this.__enforceHostEventTarget(newEvent); this.$$slot('_button').dispatchEvent(newEvent); } + /** + * Prevent click on the fake element and cause click on the native button. + */ + __clickDelegationHandler(e) { + e.stopPropagation(); + this._redispatchClickEvent(e); + } + __enforceHostEventTarget(event) { try { // this is for IE11 (and works in others), because `Object.defineProperty` does not give any effect there