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();
|
this.__teardownDelegation();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
_redispatchClickEvent(oldEvent) {
|
||||||
* Prevent click on the fake element and cause click on the native button.
|
|
||||||
*/
|
|
||||||
__clickDelegationHandler(oldEvent) {
|
|
||||||
oldEvent.stopPropagation();
|
|
||||||
// replacing `MouseEvent` with `oldEvent.constructor` breaks IE
|
// replacing `MouseEvent` with `oldEvent.constructor` breaks IE
|
||||||
const newEvent = new MouseEvent(oldEvent.type, oldEvent);
|
const newEvent = new MouseEvent(oldEvent.type, oldEvent);
|
||||||
this.__enforceHostEventTarget(newEvent);
|
this.__enforceHostEventTarget(newEvent);
|
||||||
this.$$slot('_button').dispatchEvent(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) {
|
__enforceHostEventTarget(event) {
|
||||||
try {
|
try {
|
||||||
// this is for IE11 (and works in others), because `Object.defineProperty` does not give any effect there
|
// this is for IE11 (and works in others), because `Object.defineProperty` does not give any effect there
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue