-
Notifications
You must be signed in to change notification settings - Fork 3
/
event-constructor-polyfill.min.js
1 lines (1 loc) · 2.77 KB
/
event-constructor-polyfill.min.js
1
(function(){try{var e=new window.Event("event",{bubbles:true,cancelable:true})}catch(e){var t=window.CustomEvent||window.Event;var o=function(e,t){t=t||{};var o=document.createEvent("Event");o.initEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.detail===void 0?{}:t.detail);return o};o.prototype=t.prototype;window.Event=o}try{var e=new window.CustomEvent("event",{bubbles:true,cancelable:true})}catch(e){var n=window.CustomEvent||window.Event;var a=function(e,t){t=t||{};var o=document.createEvent("CustomEvent");o.initCustomEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.detail===void 0?{}:t.detail);return o};a.prototype=n.prototype;window.CustomEvent=a}try{var e=new window.MouseEvent("event",{bubbles:true,cancelable:true})}catch(e){var i=window.MouseEvent||window.Event;var v=function(e,t){t=t||{};var o=document.createEvent("MouseEvent");o.initMouseEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.view===void 0?window:t.view,t.detail===void 0?0:t.detail,t.screenX===void 0?0:t.screenX,t.screenY===void 0?0:t.screenY,t.clientX===void 0?0:t.clientX,t.clientY===void 0?0:t.clientY,t.ctrlKey===void 0?false:t.ctrlKey,t.altKey===void 0?false:t.altKey,t.shiftKey===void 0?false:t.shiftKey,t.metaKey===void 0?false:t.metaKey,t.button===void 0?0:t.button,t.relatedTarget===void 0?null:t.relatedTarget);o.buttons=t.buttons===void 0?0:t.buttons;o.region=t.region===void 0?null:t.region;return o};v.prototype=i.prototype;window.MouseEvent=v}try{var e=new window.KeyboardEvent("event",{bubbles:true,cancelable:true})}catch(e){var l=window.KeyboardEvent||window.Event;var r=function(e,t){t=t||{};var o=document.createEvent("KeyboardEvent");o.initKeyboardEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.view===void 0?window:t.view,t.key===void 0?"":t.key,t.location===void 0?0:t.location,(t.ctrlKey===true?"Control ":"")+(t.altKey===true?"Alt ":"")+(t.shiftKey===true?"Shift ":"")+(t.metaKey===true?"Meta ":""),t.repeat===void 0?false:t.repeat,t.locale===void 0?navigator.language:t.locale);o.keyCode=t.keyCode===void 0?0:t.keyCode;o.code=t.code===void 0?"":t.code;o.charCode=t.charCode===void 0?0:t.charCode;o.char=t.charCode===void 0?"":t.charCode;o.which=t.which===void 0?0:t.which;return o};r.prototype=l.prototype;window.KeyboardEvent=r}try{var e=new window.FocusEvent("event",{bubbles:true,cancelable:true})}catch(e){var d=window.FocusEvent||window.Event;var c=function(e,t){t=t||{};var o=document.createEvent("FocusEvent");o.initFocusEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.view===void 0?window:t.view,t.detail===void 0?{}:t.detail,t.relatedTarget===void 0?null:t.relatedTarget);return o};c.prototype=d.prototype;window.FocusEvent=c}})();