event-target-shim icon indicating copy to clipboard operation
event-target-shim copied to clipboard

Uncaught TypeError: EventTarget.dispatchEvent: Argument 1 does not implement interface Event.

Open codermapuche opened this issue 1 year ago • 0 comments

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?

codermapuche avatar Jan 31 '24 12:01 codermapuche