events-polyfill
Advanced tools
Comparing version 1.1.10 to 1.1.11
@@ -9,2 +9,24 @@ (function() { | ||
/** | ||
* Polyfill Event | ||
*/ | ||
try { | ||
var event = new window.Event('event', { bubbles: true, cancelable: true }); | ||
} catch (error) { | ||
var EventOriginal = window.CustomEvent || window.Event; | ||
var Event = function(eventName, params) { | ||
params = params || {}; | ||
var event = document.createEvent('Event'); | ||
event.initEvent( | ||
eventName, | ||
(params.bubbles === void 0) ? false : params.bubbles, | ||
(params.cancelable === void 0) ? false : params.cancelable, | ||
(params.detail === void 0) ? {} : params.detail | ||
); | ||
return event; | ||
}; | ||
Event.prototype = EventOriginal.prototype; | ||
window.Event = Event; | ||
} | ||
/** | ||
* Polyfill CustomEvent | ||
@@ -11,0 +33,0 @@ */ |
@@ -1,1 +0,1 @@ | ||
(function(){try{var e=new window.CustomEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.CustomEvent||window.Event;var o=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};o.prototype=t.prototype;window.CustomEvent=o}try{var e=new window.MouseEvent("event",{bubbles:true,cancelable:true})}catch(e){var n=window.MouseEvent||window.Event;var a=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};a.prototype=n.prototype;window.MouseEvent=a}try{var e=new window.KeyboardEvent("event",{bubbles:true,cancelable:true})}catch(e){var i=window.KeyboardEvent||window.Event;var v=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};v.prototype=i.prototype;window.KeyboardEvent=v}try{var e=new window.FocusEvent("event",{bubbles:true,cancelable:true})}catch(e){var d=window.FocusEvent||window.Event;var r=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};r.prototype=d.prototype;window.FocusEvent=r}})(); | ||
(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}})(); |
{ | ||
"name": "events-polyfill", | ||
"version": "1.1.10", | ||
"description": "Polyfill event : EventListener, EventTarget, CustomEvent, MouseEvent, KeyboardEvent, FocusEvent", | ||
"version": "1.1.11", | ||
"description": "Polyfill event : EventListener, EventTarget, Event, CustomEvent, MouseEvent, KeyboardEvent, FocusEvent", | ||
"main": "event-constructor-polyfill.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -11,3 +11,5 @@ ### Polyfill different events classes and methods to match last ES7 specifications | ||
#### event-constructor-polyfill.js | ||
Polyfill for : [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent), | ||
Polyfill for : | ||
[Event](https://developer.mozilla.org/en-US/docs/Web/API/Event), | ||
[CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent), | ||
[MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent), | ||
@@ -14,0 +16,0 @@ [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent), |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32454
673
62