Merge pull request #275 from ing-bank/fix/focusEventIE11
Change FocusEvent to regular Event to support IE11
This commit is contained in:
commit
f8a4da52ee
2 changed files with 8 additions and 8 deletions
|
|
@ -82,14 +82,14 @@ export const FocusMixin = dedupeMixin(
|
||||||
// focus
|
// focus
|
||||||
this.__redispatchFocus = ev => {
|
this.__redispatchFocus = ev => {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
this.dispatchEvent(new FocusEvent('focus'));
|
this.dispatchEvent(new Event('focus'));
|
||||||
};
|
};
|
||||||
this.inputElement.addEventListener('focus', this.__redispatchFocus);
|
this.inputElement.addEventListener('focus', this.__redispatchFocus);
|
||||||
|
|
||||||
// blur
|
// blur
|
||||||
this.__redispatchBlur = ev => {
|
this.__redispatchBlur = ev => {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
this.dispatchEvent(new FocusEvent('blur'));
|
this.dispatchEvent(new Event('blur'));
|
||||||
};
|
};
|
||||||
this.inputElement.addEventListener('blur', this.__redispatchBlur);
|
this.inputElement.addEventListener('blur', this.__redispatchBlur);
|
||||||
|
|
||||||
|
|
@ -97,7 +97,7 @@ export const FocusMixin = dedupeMixin(
|
||||||
this.__redispatchFocusin = ev => {
|
this.__redispatchFocusin = ev => {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
this._onFocus(ev);
|
this._onFocus(ev);
|
||||||
this.dispatchEvent(new FocusEvent('focusin', { bubbles: true, composed: true }));
|
this.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
|
||||||
};
|
};
|
||||||
this.inputElement.addEventListener('focusin', this.__redispatchFocusin);
|
this.inputElement.addEventListener('focusin', this.__redispatchFocusin);
|
||||||
|
|
||||||
|
|
@ -105,7 +105,7 @@ export const FocusMixin = dedupeMixin(
|
||||||
this.__redispatchFocusout = ev => {
|
this.__redispatchFocusout = ev => {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
this._onBlur();
|
this._onBlur();
|
||||||
this.dispatchEvent(new FocusEvent('focusout', { bubbles: true, composed: true }));
|
this.dispatchEvent(new Event('focusout', { bubbles: true, composed: true }));
|
||||||
};
|
};
|
||||||
this.inputElement.addEventListener('focusout', this.__redispatchFocusout);
|
this.inputElement.addEventListener('focusout', this.__redispatchFocusout);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ describe('FocusMixin', () => {
|
||||||
`);
|
`);
|
||||||
setTimeout(() => el.focus());
|
setTimeout(() => el.focus());
|
||||||
const focusEv = await oneEvent(el, 'focus');
|
const focusEv = await oneEvent(el, 'focus');
|
||||||
expect(focusEv).to.be.instanceOf(FocusEvent);
|
expect(focusEv).to.be.instanceOf(Event);
|
||||||
expect(focusEv.target).to.equal(el);
|
expect(focusEv.target).to.equal(el);
|
||||||
expect(focusEv.bubbles).to.be.false;
|
expect(focusEv.bubbles).to.be.false;
|
||||||
expect(focusEv.composed).to.be.false;
|
expect(focusEv.composed).to.be.false;
|
||||||
|
|
@ -87,7 +87,7 @@ describe('FocusMixin', () => {
|
||||||
el.blur();
|
el.blur();
|
||||||
});
|
});
|
||||||
const blurEv = await oneEvent(el, 'blur');
|
const blurEv = await oneEvent(el, 'blur');
|
||||||
expect(blurEv).to.be.instanceOf(FocusEvent);
|
expect(blurEv).to.be.instanceOf(Event);
|
||||||
expect(blurEv.target).to.equal(el);
|
expect(blurEv.target).to.equal(el);
|
||||||
expect(blurEv.bubbles).to.be.false;
|
expect(blurEv.bubbles).to.be.false;
|
||||||
expect(blurEv.composed).to.be.false;
|
expect(blurEv.composed).to.be.false;
|
||||||
|
|
@ -99,7 +99,7 @@ describe('FocusMixin', () => {
|
||||||
`);
|
`);
|
||||||
setTimeout(() => el.focus());
|
setTimeout(() => el.focus());
|
||||||
const focusinEv = await oneEvent(el, 'focusin');
|
const focusinEv = await oneEvent(el, 'focusin');
|
||||||
expect(focusinEv).to.be.instanceOf(FocusEvent);
|
expect(focusinEv).to.be.instanceOf(Event);
|
||||||
expect(focusinEv.target).to.equal(el);
|
expect(focusinEv.target).to.equal(el);
|
||||||
expect(focusinEv.bubbles).to.be.true;
|
expect(focusinEv.bubbles).to.be.true;
|
||||||
expect(focusinEv.composed).to.be.true;
|
expect(focusinEv.composed).to.be.true;
|
||||||
|
|
@ -109,7 +109,7 @@ describe('FocusMixin', () => {
|
||||||
el.blur();
|
el.blur();
|
||||||
});
|
});
|
||||||
const focusoutEv = await oneEvent(el, 'focusout');
|
const focusoutEv = await oneEvent(el, 'focusout');
|
||||||
expect(focusoutEv).to.be.instanceOf(FocusEvent);
|
expect(focusoutEv).to.be.instanceOf(Event);
|
||||||
expect(focusoutEv.target).to.equal(el);
|
expect(focusoutEv.target).to.equal(el);
|
||||||
expect(focusoutEv.bubbles).to.be.true;
|
expect(focusoutEv.bubbles).to.be.true;
|
||||||
expect(focusoutEv.composed).to.be.true;
|
expect(focusoutEv.composed).to.be.true;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue