event-target-shim
event-target-shim copied to clipboard
Uncaught TypeError: EventTarget.dispatchEvent: Argument 1 does not implement interface Event.
window.EventTarget = EventTargetShim.EventTarget;
window.Event = EventTargetShim.Event;
window.getEventAttributeValue = EventTargetShim.getEventAttributeValue;
window.setEventAttributeValue = EventTargetShim.setEventAttributeValue;
// ---
const input = document.createElement('input');
input.dispatchEvent(new Event('change', { bubbles: true }));
I do the first part in my site, overriding native with shim for have a homogeneous behavior in all devices.
Most things works as expected, but the second part of code throws
Uncaught TypeError: EventTarget.dispatchEvent: Argument 1 does not implement interface Event.
Maybe EventTargetShim.Event can be a instance of native Event if its is defined for fix this problem?