fix(button): make redispatch method protected
This commit is contained in:
parent
59e456e11f
commit
b7eb537d1d
1 changed files with 9 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue