OpenAuth_server/FrontendLegacy/shared/event.js

13 lines
437 B
JavaScript
Raw Permalink Normal View History

2018-11-06 19:48:50 +00:00
export default function fireEvent(element, event) {
if (document.createEventObject) {
// dispatch for IE
var evt = document.createEventObject();
2020-08-07 14:16:39 +00:00
return element.fireEvent("on" + event, evt);
} else {
2018-11-06 19:48:50 +00:00
// dispatch for firefox + others
var evt = document.createEvent("HTMLEvents");
evt.initEvent(event, true, true); // event type,bubbling,cancelable
return !element.dispatchEvent(evt);
}
2020-08-07 14:16:39 +00:00
}