events-polyfill
Advanced tools
Comparing version 1.1.9 to 1.1.10
@@ -132,2 +132,33 @@ (function() { | ||
} | ||
/** | ||
* Polyfill FocusEvent : https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent | ||
* - relatedTarget ✓ | ||
*/ | ||
try { | ||
var event = new window.FocusEvent('event', { bubbles: true, cancelable: true }); | ||
} catch (error) { | ||
var FocusEventOriginal = window.FocusEvent || window.Event; | ||
var FocusEvent = function(eventName, params) { | ||
params = params || {}; | ||
var event = document.createEvent('FocusEvent'); | ||
// https://msdn.microsoft.com/en-us/library/ff975954(v=vs.85).aspx | ||
event.initFocusEvent( | ||
eventName, | ||
(params.bubbles === void 0) ? false : params.bubbles, | ||
(params.cancelable === void 0) ? false : params.cancelable, | ||
(params.view === void 0) ? window : params.view, | ||
(params.detail === void 0) ? {} : params.detail, | ||
(params.relatedTarget === void 0) ? null : params.relatedTarget | ||
); | ||
return event; | ||
}; | ||
FocusEvent.prototype = FocusEventOriginal.prototype; | ||
window.FocusEvent = FocusEvent; | ||
} | ||
})(); |
@@ -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}})(); | ||
(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}})(); |
{ | ||
"name": "events-polyfill", | ||
"version": "1.1.9", | ||
"description": "Polyfill event : EventListener, EventTarget, CustomEvent, MouseEvent, KeyboardEvent", | ||
"version": "1.1.10", | ||
"description": "Polyfill event : EventListener, EventTarget, CustomEvent, MouseEvent, KeyboardEvent, FocusEvent", | ||
"main": "event-constructor-polyfill.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -11,3 +11,6 @@ ### 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), [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent) and [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent) | ||
Polyfill for : [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent), | ||
[MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent), | ||
[KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent), | ||
[FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent) | ||
@@ -14,0 +17,0 @@ #### event-listener-polyfill.js |
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
31343
652
60