events-polyfill
Advanced tools
Comparing version 2.0.7 to 2.1.0
75
index.js
@@ -445,3 +445,28 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
},{"./EventListenerInterceptor.js":1}],4:[function(require,module,exports){ | ||
(function() { | ||
module.exports = (function() { | ||
return function ApplyThisPrototype(event, target) { | ||
if ((typeof target === 'object') && (target !== null)) { | ||
var proto = Object.getPrototypeOf(target); | ||
var property; | ||
for (property in proto) { | ||
if (!(property in event)) { | ||
var descriptor = Object.getOwnPropertyDescriptor(proto, property); | ||
if (descriptor) { | ||
Object.defineProperty(event, property, descriptor); | ||
} | ||
} | ||
} | ||
for (property in target) { | ||
if (!(property in event)) { | ||
event[property] = target[property]; | ||
} | ||
} | ||
} | ||
} | ||
})(); | ||
},{}],5:[function(require,module,exports){ | ||
(function(ApplyThisPrototype) { | ||
/** | ||
@@ -463,2 +488,3 @@ * Polyfill CustomEvent | ||
); | ||
ApplyThisPrototype(event, this); | ||
return event; | ||
@@ -469,5 +495,5 @@ }; | ||
} | ||
})(); | ||
},{}],5:[function(require,module,exports){ | ||
(function() { | ||
})(require('./ApplyThisPrototype.js')); | ||
},{"./ApplyThisPrototype.js":4}],6:[function(require,module,exports){ | ||
(function(ApplyThisPrototype) { | ||
// ✓, ✗ | ||
@@ -491,2 +517,3 @@ | ||
); | ||
ApplyThisPrototype(event, this); | ||
return event; | ||
@@ -497,5 +524,5 @@ }; | ||
} | ||
})(); | ||
},{}],6:[function(require,module,exports){ | ||
(function() { | ||
})(require('./ApplyThisPrototype.js')); | ||
},{"./ApplyThisPrototype.js":4}],7:[function(require,module,exports){ | ||
(function(ApplyThisPrototype) { | ||
/** | ||
@@ -523,2 +550,4 @@ * Polyfill FocusEvent : https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent | ||
ApplyThisPrototype(event, this); | ||
return event; | ||
@@ -529,5 +558,5 @@ }; | ||
} | ||
})(); | ||
},{}],7:[function(require,module,exports){ | ||
(function() { | ||
})(require('./ApplyThisPrototype.js')); | ||
},{"./ApplyThisPrototype.js":4}],8:[function(require,module,exports){ | ||
(function(ApplyThisPrototype) { | ||
/** | ||
@@ -579,2 +608,4 @@ * Polyfill KeyboardEvent : https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent | ||
ApplyThisPrototype(event, this); | ||
return event; | ||
@@ -586,5 +617,5 @@ }; | ||
})(); | ||
},{}],8:[function(require,module,exports){ | ||
(function() { | ||
})(require('./ApplyThisPrototype.js')); | ||
},{"./ApplyThisPrototype.js":4}],9:[function(require,module,exports){ | ||
(function(ApplyThisPrototype) { | ||
/** | ||
@@ -634,2 +665,4 @@ * Polyfill MouseEvent : https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent | ||
ApplyThisPrototype(event, this); | ||
return event; | ||
@@ -640,5 +673,5 @@ }; | ||
} | ||
})(); | ||
},{}],9:[function(require,module,exports){ | ||
(function() { | ||
})(require('./ApplyThisPrototype.js')); | ||
},{"./ApplyThisPrototype.js":4}],10:[function(require,module,exports){ | ||
(function(ApplyThisPrototype) { | ||
/** | ||
@@ -699,2 +732,4 @@ * Polyfill PointerEvent | ||
ApplyThisPrototype(event, this); | ||
return event; | ||
@@ -712,4 +747,4 @@ }; | ||
} | ||
})(); | ||
},{}],10:[function(require,module,exports){ | ||
})(require('./ApplyThisPrototype.js')); | ||
},{"./ApplyThisPrototype.js":4}],11:[function(require,module,exports){ | ||
require('./Event.js'); | ||
@@ -721,3 +756,3 @@ require('./CustomEvent.js'); | ||
require('./PointerEvent.js'); | ||
},{"./CustomEvent.js":4,"./Event.js":5,"./FocusEvent.js":6,"./KeyboardEvent.js":7,"./MouseEvent.js":8,"./PointerEvent.js":9}],11:[function(require,module,exports){ | ||
},{"./CustomEvent.js":5,"./Event.js":6,"./FocusEvent.js":7,"./KeyboardEvent.js":8,"./MouseEvent.js":9,"./PointerEvent.js":10}],12:[function(require,module,exports){ | ||
require('./constructors/index.js'); | ||
@@ -727,2 +762,2 @@ require('./ListenerOptions.js'); | ||
},{"./ListenerEventTypes.js":2,"./ListenerOptions.js":3,"./constructors/index.js":10}]},{},[11]); | ||
},{"./ListenerEventTypes.js":2,"./ListenerOptions.js":3,"./constructors/index.js":11}]},{},[12]); |
@@ -1,1 +0,1 @@ | ||
(function o(s,a,l){function p(n,e){if(!a[n]){if(!s[n]){var t=typeof require=="function"&&require;if(!e&&t)return t(n,!0);if(u)return u(n,!0);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}var r=a[n]={exports:{}};s[n][0].call(r.exports,function(e){var t=s[n][1][e];return p(t?t:e)},r,r.exports,o,s,a,l)}return a[n].exports}var u=typeof require=="function"&&require;for(var e=0;e<l.length;e++)p(l[e]);return p})({1:[function(e,t,n){t.exports=function(){if(typeof EventTarget==="undefined"){window.EventTarget=Node}var e={interceptors:[]};e.getRegisteredEventListener=function(e,t){var n=t.type+"-"+(t.options.capture?"1":"0");if(e.__eventListeners!==void 0&&e.__eventListeners[n]!==void 0){var i=e.__eventListeners[n];for(var r=0;r<i.length;r++){if(i[r].listener===t.listener){return i[r]}}}return null};e.registerEventListener=function(e,t){var n=t.type+"-"+(t.options.capture?"1":"0");if(e.__eventListeners===void 0){e.__eventListeners={}}if(e.__eventListeners[n]===void 0){e.__eventListeners[n]=[]}e.__eventListeners[n].push(t)};e.unregisterEventListener=function(e,t){var n=t.type+"-"+(t.options.capture?"1":"0");if(e.__eventListeners!==void 0&&e.__eventListeners[n]!==void 0){var i=e.__eventListeners[n];for(var r=0;r<i.length;r++){if(i[r].listener===t.listener){i.splice(r,1)}}if(i.length===0){delete e.__eventListeners[n]}}};e.normalizeListenerCallback=function(t){if(typeof t==="function"){return t}else if(typeof t==="object"&&typeof t.handleEvent==="function"){return t.handleEvent}else{return function(e){t(e)}}};e.normalizeListenerOptions=function(e){switch(typeof e){case"boolean":e={capture:e};break;case"undefined":e={capture:false};break;case"object":break;default:throw new Error("Unsupported options type for addEventListener")}e.once=Boolean(e.once);e.passive=Boolean(e.passive);e.capture=Boolean(e.capture);return e};e.normalizeListenerArguments=function(e,t,n){return{type:e,listener:this.normalizeListenerCallback(t),options:this.normalizeListenerOptions(n)}};e.intercept=function(e,t){var n=null;for(var i=0;i<this.interceptors.length;i++){if(this.interceptors[i].target===e){n=this.interceptors[i]}}if(n===null){n={target:e,interceptors:[t]};this.interceptors.push(n);this.interceptAddEventListener(e,n);this.interceptRemoveEventListener(e,n)}else{n.interceptors.push(t)}};e.interceptAddEventListener=function(e,a){var l=this;var p=e.prototype.addEventListener;e.prototype.addEventListener=function(e,t,n){var i=l.normalizeListenerArguments(e,t,n);var r=l.getRegisteredEventListener(this,i);if(!r){i.polyfilled={type:i.type,listener:i.listener,options:{capture:i.options.capture,once:i.options.once,passive:i.options.passive}};for(var o=0;o<a.interceptors.length;o++){var s=a.interceptors[o];if(typeof s.add==="function"){s.add(i)}}l.registerEventListener(this,i);p.call(this,i.polyfilled.type,i.polyfilled.listener,i.polyfilled.options)}};return function(){e.prototype.addEventListener=p}};e.interceptRemoveEventListener=function(e,t){var o=this;var s=e.prototype.removeEventListener;e.prototype.removeEventListener=function(e,t,n){var i=o.normalizeListenerArguments(e,t,n);var r=o.getRegisteredEventListener(this,i);if(r){o.unregisterEventListener(this,i);s.call(this,r.polyfilled.type,r.polyfilled.listener,r.polyfilled.options)}else{s.call(this,e,t,n)}};return function(){e.prototype.removeEventListener=s}};e.interceptAll=function(e){this.intercept(EventTarget,e);if(!(window instanceof EventTarget)){this.intercept(Window,e)}};e.releaseAll=function(){for(var e=0,t=this.interceptors.length;e<t;e++){this.interceptors()}};e.error=function(e){console.error(e)};return e}()},{}],2:[function(e,t,n){(function(n){n.isSupportedOnEvent=function(e,t){return"on"+t in e};n.isSupportedTransitionEvent=function(e,t){return n.isSupportedOnEvent(e,t)||"style"in e&&e.style["transition"]!==void 0};n.isSupportedFullScreenEvent=function(e,t){if(n.isSupportedOnEvent(e,t)){return true}else{if(/^ms/.test(t.toLowerCase())){return"msRequestFullscreen"in document.body}else if(/^moz/.test(t)){return"mozRequestFullscreen"in document.body}else if(/^webkit/.test(t)){return"webkitRequestFullscreen"in document.body}else{return false}}};n.generateEventTypes=function(){var n=this;this.eventTypes={};this.vendorPrefixes=["","webkit","moz","ms","o"];this.eventTypes["wheel"]=["wheel","mousewheel","DOMMouseScroll"].map(function(e){return{type:e,isSupported:n.isSupportedOnEvent}});this.eventTypes["fullscreenchange"]=["fullscreenchange","mozfullscreenchange","webkitfullscreenchange","MSFullscreenChange","msfullscreenchange"].map(function(e){return{type:e,isSupported:n.isSupportedFullScreenEvent}});this.eventTypes["fullscreenerror"]=["fullscreenerror","mozfullscreenerror","webkitfullscreenerror","MSFullscreenError","msfullscreenerror"].map(function(e){return{type:e,isSupported:n.isSupportedFullScreenEvent}});["pointerlockchange","pointerlockerror","animationstart","animationiteration","animationend","pointercancel","pointerdown","pointerhover","pointermove","pointerout","pointerover","pointerup"].forEach(function(t){n.eventTypes[t]=n.vendorPrefixes.map(function(e){return{type:e+t,isSupported:n.isSupportedOnEvent}})});["transitionstart","transitionrun","transitionend"].forEach(function(t){n.eventTypes[t]=n.vendorPrefixes.map(function(e){return{type:e+t,isSupported:n.isSupportedTransitionEvent}})})};n.getSupportedEventType=function(e,t){var n=this.eventTypes[t];if(n===void 0){return t}else{var i;for(var r=0;r<n.length;r++){i=n[r];if(i.isSupported(e,i.type)){return i.type}}return t}};n.polyfillListenerEventTypes=function(){this.generateEventTypes();var t=this;this.interceptAll({add:function(e){e.polyfilled.type=t.getSupportedEventType(this,e.polyfilled.type)}})};n.polyfillListenerEventTypes()})(e("./EventListenerInterceptor.js"))},{"./EventListenerInterceptor.js":1}],3:[function(e,t,n){(function(e){e.detectSupportedOptions=function(){var e=this;this.supportedOptions={once:false,passive:false,capture:false,all:false,some:false};document.createDocumentFragment().addEventListener("test",function(){},{get once(){e.supportedOptions.once=true;return false},get passive(){e.supportedOptions.passive=true;return false},get capture(){e.supportedOptions.capture=true;return false}});this.supportedOptions.all=this.supportedOptions.once&&this.supportedOptions.passive&&this.supportedOptions.capture;this.supportedOptions.some=this.supportedOptions.once||this.supportedOptions.passive||this.supportedOptions.capture};e.polyfillListenerOptions=function(){this.detectSupportedOptions();if(!this.supportedOptions.all){var e=this;this.interceptAll({add:function(t){var n=t.options.once&&!e.supportedOptions.once;var i=t.options.passive&&!e.supportedOptions.passive;if(n||i){var r=t.polyfilled.listener;t.polyfilled.listener=function(e){if(n){this.removeEventListener(t.type,t.listener,t.options)}if(i){e.preventDefault=function(){throw new Error("Unable to preventDefault inside passive event listener invocation.")}}return r.call(this,e)}}if(!e.supportedOptions.some){t.polyfilled.options=t.options.capture}}})}};e.polyfillListenerOptions()})(e("./EventListenerInterceptor.js"))},{"./EventListenerInterceptor.js":1}],4:[function(e,t,n){(function(){try{var e=new window.CustomEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.CustomEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("CustomEvent");n.initCustomEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.detail===void 0?{}:t.detail);return n};n.prototype=t.prototype;window.CustomEvent=n}})()},{}],5:[function(e,t,n){(function(){try{var e=new window.Event("event",{bubbles:true,cancelable:true})}catch(e){var t=window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("Event");n.initEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.detail===void 0?{}:t.detail);return n};n.prototype=t.prototype;window.Event=n}})()},{}],6:[function(e,t,n){(function(){try{var e=new window.FocusEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.FocusEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("FocusEvent");n.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 n};n.prototype=t.prototype;window.FocusEvent=n}})()},{}],7:[function(e,t,n){(function(){try{var e=new window.KeyboardEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.KeyboardEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("KeyboardEvent");n.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);n.keyCode=t.keyCode===void 0?0:t.keyCode;n.code=t.code===void 0?"":t.code;n.charCode=t.charCode===void 0?0:t.charCode;n.char=t.charCode===void 0?"":t.charCode;n.which=t.which===void 0?0:t.which;return n};n.prototype=t.prototype;window.KeyboardEvent=n}})()},{}],8:[function(e,t,n){(function(){try{var e=new window.MouseEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.MouseEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("MouseEvent");n.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);n.buttons=t.buttons===void 0?0:t.buttons;n.region=t.region===void 0?null:t.region;return n};n.prototype=t.prototype;window.MouseEvent=n}})()},{}],9:[function(e,t,n){(function(){try{var e=new window.PointerEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.PointerEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("PointerEvent");n.initPointerEvent(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,t.offsetX===void 0?0:t.offsetX,t.offsetY===void 0?0:t.offsetY,t.width===void 0?1:t.width,t.height===void 0?1:t.height,t.pressure===void 0?0:t.pressure,t.twist===void 0?0:t.twist,t.tiltX===void 0?0:t.tiltX,t.tiltY===void 0?0:t.tiltY,t.pointerId===void 0?0:t.pointerId,t.pointerType===void 0?"":t.pointerType,t.hwTimestamp===void 0?0:t.hwTimestamp,t.isPrimary===void 0?false:t.isPrimary);n.tangentialPressure=t.tangentialPressure===void 0?0:t.tangentialPressure;return n};n.prototype=t.prototype;var i=Object.getOwnPropertyDescriptor(n.prototype,"rotation");if(i){Object.defineProperty(n.prototype,"twist",i)}window.PointerEvent=n}})()},{}],10:[function(e,t,n){e("./Event.js");e("./CustomEvent.js");e("./MouseEvent.js");e("./KeyboardEvent.js");e("./FocusEvent.js");e("./PointerEvent.js")},{"./CustomEvent.js":4,"./Event.js":5,"./FocusEvent.js":6,"./KeyboardEvent.js":7,"./MouseEvent.js":8,"./PointerEvent.js":9}],11:[function(e,t,n){e("./constructors/index.js");e("./ListenerOptions.js");e("./ListenerEventTypes.js")},{"./ListenerEventTypes.js":2,"./ListenerOptions.js":3,"./constructors/index.js":10}]},{},[11]); | ||
(function o(s,p,l){function a(n,e){if(!p[n]){if(!s[n]){var t=typeof require=="function"&&require;if(!e&&t)return t(n,!0);if(u)return u(n,!0);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}var r=p[n]={exports:{}};s[n][0].call(r.exports,function(e){var t=s[n][1][e];return a(t?t:e)},r,r.exports,o,s,p,l)}return p[n].exports}var u=typeof require=="function"&&require;for(var e=0;e<l.length;e++)a(l[e]);return a})({1:[function(e,t,n){t.exports=function(){if(typeof EventTarget==="undefined"){window.EventTarget=Node}var e={interceptors:[]};e.getRegisteredEventListener=function(e,t){var n=t.type+"-"+(t.options.capture?"1":"0");if(e.__eventListeners!==void 0&&e.__eventListeners[n]!==void 0){var i=e.__eventListeners[n];for(var r=0;r<i.length;r++){if(i[r].listener===t.listener){return i[r]}}}return null};e.registerEventListener=function(e,t){var n=t.type+"-"+(t.options.capture?"1":"0");if(e.__eventListeners===void 0){e.__eventListeners={}}if(e.__eventListeners[n]===void 0){e.__eventListeners[n]=[]}e.__eventListeners[n].push(t)};e.unregisterEventListener=function(e,t){var n=t.type+"-"+(t.options.capture?"1":"0");if(e.__eventListeners!==void 0&&e.__eventListeners[n]!==void 0){var i=e.__eventListeners[n];for(var r=0;r<i.length;r++){if(i[r].listener===t.listener){i.splice(r,1)}}if(i.length===0){delete e.__eventListeners[n]}}};e.normalizeListenerCallback=function(t){if(typeof t==="function"){return t}else if(typeof t==="object"&&typeof t.handleEvent==="function"){return t.handleEvent}else{return function(e){t(e)}}};e.normalizeListenerOptions=function(e){switch(typeof e){case"boolean":e={capture:e};break;case"undefined":e={capture:false};break;case"object":break;default:throw new Error("Unsupported options type for addEventListener")}e.once=Boolean(e.once);e.passive=Boolean(e.passive);e.capture=Boolean(e.capture);return e};e.normalizeListenerArguments=function(e,t,n){return{type:e,listener:this.normalizeListenerCallback(t),options:this.normalizeListenerOptions(n)}};e.intercept=function(e,t){var n=null;for(var i=0;i<this.interceptors.length;i++){if(this.interceptors[i].target===e){n=this.interceptors[i]}}if(n===null){n={target:e,interceptors:[t]};this.interceptors.push(n);this.interceptAddEventListener(e,n);this.interceptRemoveEventListener(e,n)}else{n.interceptors.push(t)}};e.interceptAddEventListener=function(e,p){var l=this;var a=e.prototype.addEventListener;e.prototype.addEventListener=function(e,t,n){var i=l.normalizeListenerArguments(e,t,n);var r=l.getRegisteredEventListener(this,i);if(!r){i.polyfilled={type:i.type,listener:i.listener,options:{capture:i.options.capture,once:i.options.once,passive:i.options.passive}};for(var o=0;o<p.interceptors.length;o++){var s=p.interceptors[o];if(typeof s.add==="function"){s.add(i)}}l.registerEventListener(this,i);a.call(this,i.polyfilled.type,i.polyfilled.listener,i.polyfilled.options)}};return function(){e.prototype.addEventListener=a}};e.interceptRemoveEventListener=function(e,t){var o=this;var s=e.prototype.removeEventListener;e.prototype.removeEventListener=function(e,t,n){var i=o.normalizeListenerArguments(e,t,n);var r=o.getRegisteredEventListener(this,i);if(r){o.unregisterEventListener(this,i);s.call(this,r.polyfilled.type,r.polyfilled.listener,r.polyfilled.options)}else{s.call(this,e,t,n)}};return function(){e.prototype.removeEventListener=s}};e.interceptAll=function(e){this.intercept(EventTarget,e);if(!(window instanceof EventTarget)){this.intercept(Window,e)}};e.releaseAll=function(){for(var e=0,t=this.interceptors.length;e<t;e++){this.interceptors()}};e.error=function(e){console.error(e)};return e}()},{}],2:[function(e,t,n){(function(n){n.isSupportedOnEvent=function(e,t){return"on"+t in e};n.isSupportedTransitionEvent=function(e,t){return n.isSupportedOnEvent(e,t)||"style"in e&&e.style["transition"]!==void 0};n.isSupportedFullScreenEvent=function(e,t){if(n.isSupportedOnEvent(e,t)){return true}else{if(/^ms/.test(t.toLowerCase())){return"msRequestFullscreen"in document.body}else if(/^moz/.test(t)){return"mozRequestFullscreen"in document.body}else if(/^webkit/.test(t)){return"webkitRequestFullscreen"in document.body}else{return false}}};n.generateEventTypes=function(){var n=this;this.eventTypes={};this.vendorPrefixes=["","webkit","moz","ms","o"];this.eventTypes["wheel"]=["wheel","mousewheel","DOMMouseScroll"].map(function(e){return{type:e,isSupported:n.isSupportedOnEvent}});this.eventTypes["fullscreenchange"]=["fullscreenchange","mozfullscreenchange","webkitfullscreenchange","MSFullscreenChange","msfullscreenchange"].map(function(e){return{type:e,isSupported:n.isSupportedFullScreenEvent}});this.eventTypes["fullscreenerror"]=["fullscreenerror","mozfullscreenerror","webkitfullscreenerror","MSFullscreenError","msfullscreenerror"].map(function(e){return{type:e,isSupported:n.isSupportedFullScreenEvent}});["pointerlockchange","pointerlockerror","animationstart","animationiteration","animationend","pointercancel","pointerdown","pointerhover","pointermove","pointerout","pointerover","pointerup"].forEach(function(t){n.eventTypes[t]=n.vendorPrefixes.map(function(e){return{type:e+t,isSupported:n.isSupportedOnEvent}})});["transitionstart","transitionrun","transitionend"].forEach(function(t){n.eventTypes[t]=n.vendorPrefixes.map(function(e){return{type:e+t,isSupported:n.isSupportedTransitionEvent}})})};n.getSupportedEventType=function(e,t){var n=this.eventTypes[t];if(n===void 0){return t}else{var i;for(var r=0;r<n.length;r++){i=n[r];if(i.isSupported(e,i.type)){return i.type}}return t}};n.polyfillListenerEventTypes=function(){this.generateEventTypes();var t=this;this.interceptAll({add:function(e){e.polyfilled.type=t.getSupportedEventType(this,e.polyfilled.type)}})};n.polyfillListenerEventTypes()})(e("./EventListenerInterceptor.js"))},{"./EventListenerInterceptor.js":1}],3:[function(e,t,n){(function(e){e.detectSupportedOptions=function(){var e=this;this.supportedOptions={once:false,passive:false,capture:false,all:false,some:false};document.createDocumentFragment().addEventListener("test",function(){},{get once(){e.supportedOptions.once=true;return false},get passive(){e.supportedOptions.passive=true;return false},get capture(){e.supportedOptions.capture=true;return false}});this.supportedOptions.all=this.supportedOptions.once&&this.supportedOptions.passive&&this.supportedOptions.capture;this.supportedOptions.some=this.supportedOptions.once||this.supportedOptions.passive||this.supportedOptions.capture};e.polyfillListenerOptions=function(){this.detectSupportedOptions();if(!this.supportedOptions.all){var e=this;this.interceptAll({add:function(t){var n=t.options.once&&!e.supportedOptions.once;var i=t.options.passive&&!e.supportedOptions.passive;if(n||i){var r=t.polyfilled.listener;t.polyfilled.listener=function(e){if(n){this.removeEventListener(t.type,t.listener,t.options)}if(i){e.preventDefault=function(){throw new Error("Unable to preventDefault inside passive event listener invocation.")}}return r.call(this,e)}}if(!e.supportedOptions.some){t.polyfilled.options=t.options.capture}}})}};e.polyfillListenerOptions()})(e("./EventListenerInterceptor.js"))},{"./EventListenerInterceptor.js":1}],4:[function(e,t,n){t.exports=function(){return function e(t,n){if(typeof n==="object"&&n!==null){var i=Object.getPrototypeOf(n);var r;for(r in i){if(!(r in t)){var o=Object.getOwnPropertyDescriptor(i,r);if(o){Object.defineProperty(t,r,o)}}}for(r in n){if(!(r in t)){t[r]=n[r]}}}}}()},{}],5:[function(e,t,n){(function(i){try{var e=new window.CustomEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.CustomEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("CustomEvent");n.initCustomEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.detail===void 0?{}:t.detail);i(n,this);return n};n.prototype=t.prototype;window.CustomEvent=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],6:[function(e,t,n){(function(i){try{var e=new window.Event("event",{bubbles:true,cancelable:true})}catch(e){var t=window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("Event");n.initEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.detail===void 0?{}:t.detail);i(n,this);return n};n.prototype=t.prototype;window.Event=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],7:[function(e,t,n){(function(i){try{var e=new window.FocusEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.FocusEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("FocusEvent");n.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);i(n,this);return n};n.prototype=t.prototype;window.FocusEvent=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],8:[function(e,t,n){(function(i){try{var e=new window.KeyboardEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.KeyboardEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("KeyboardEvent");n.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);n.keyCode=t.keyCode===void 0?0:t.keyCode;n.code=t.code===void 0?"":t.code;n.charCode=t.charCode===void 0?0:t.charCode;n.char=t.charCode===void 0?"":t.charCode;n.which=t.which===void 0?0:t.which;i(n,this);return n};n.prototype=t.prototype;window.KeyboardEvent=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],9:[function(e,t,n){(function(i){try{var e=new window.MouseEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.MouseEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("MouseEvent");n.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);n.buttons=t.buttons===void 0?0:t.buttons;n.region=t.region===void 0?null:t.region;i(n,this);return n};n.prototype=t.prototype;window.MouseEvent=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],10:[function(e,t,n){(function(i){try{var e=new window.PointerEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.PointerEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("PointerEvent");n.initPointerEvent(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,t.offsetX===void 0?0:t.offsetX,t.offsetY===void 0?0:t.offsetY,t.width===void 0?1:t.width,t.height===void 0?1:t.height,t.pressure===void 0?0:t.pressure,t.twist===void 0?0:t.twist,t.tiltX===void 0?0:t.tiltX,t.tiltY===void 0?0:t.tiltY,t.pointerId===void 0?0:t.pointerId,t.pointerType===void 0?"":t.pointerType,t.hwTimestamp===void 0?0:t.hwTimestamp,t.isPrimary===void 0?false:t.isPrimary);n.tangentialPressure=t.tangentialPressure===void 0?0:t.tangentialPressure;i(n,this);return n};n.prototype=t.prototype;var r=Object.getOwnPropertyDescriptor(n.prototype,"rotation");if(r){Object.defineProperty(n.prototype,"twist",r)}window.PointerEvent=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],11:[function(e,t,n){e("./Event.js");e("./CustomEvent.js");e("./MouseEvent.js");e("./KeyboardEvent.js");e("./FocusEvent.js");e("./PointerEvent.js")},{"./CustomEvent.js":5,"./Event.js":6,"./FocusEvent.js":7,"./KeyboardEvent.js":8,"./MouseEvent.js":9,"./PointerEvent.js":10}],12:[function(e,t,n){e("./constructors/index.js");e("./ListenerOptions.js");e("./ListenerEventTypes.js")},{"./ListenerEventTypes.js":2,"./ListenerOptions.js":3,"./constructors/index.js":11}]},{},[12]); |
{ | ||
"name": "events-polyfill", | ||
"version": "2.0.7", | ||
"version": "2.1.0", | ||
"description": "Polyfill event : EventListener, EventTarget, Event, CustomEvent, MouseEvent, KeyboardEvent, FocusEvent, PointerEvent and add support for options (like 'once')", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,2 +0,2 @@ | ||
(function() { | ||
(function(ApplyThisPrototype) { | ||
/** | ||
@@ -18,2 +18,3 @@ * Polyfill CustomEvent | ||
); | ||
ApplyThisPrototype(event, this); | ||
return event; | ||
@@ -24,2 +25,2 @@ }; | ||
} | ||
})(); | ||
})(require('./ApplyThisPrototype.js')); |
@@ -1,2 +0,2 @@ | ||
(function() { | ||
(function(ApplyThisPrototype) { | ||
// ✓, ✗ | ||
@@ -20,2 +20,3 @@ | ||
); | ||
ApplyThisPrototype(event, this); | ||
return event; | ||
@@ -26,2 +27,2 @@ }; | ||
} | ||
})(); | ||
})(require('./ApplyThisPrototype.js')); |
@@ -1,2 +0,2 @@ | ||
(function() { | ||
(function(ApplyThisPrototype) { | ||
/** | ||
@@ -24,2 +24,4 @@ * Polyfill FocusEvent : https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent | ||
ApplyThisPrototype(event, this); | ||
return event; | ||
@@ -30,2 +32,2 @@ }; | ||
} | ||
})(); | ||
})(require('./ApplyThisPrototype.js')); |
@@ -1,2 +0,2 @@ | ||
(function() { | ||
(function(ApplyThisPrototype) { | ||
/** | ||
@@ -48,2 +48,4 @@ * Polyfill KeyboardEvent : https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent | ||
ApplyThisPrototype(event, this); | ||
return event; | ||
@@ -55,2 +57,2 @@ }; | ||
})(); | ||
})(require('./ApplyThisPrototype.js')); |
@@ -1,2 +0,2 @@ | ||
(function() { | ||
(function(ApplyThisPrototype) { | ||
/** | ||
@@ -46,2 +46,4 @@ * Polyfill MouseEvent : https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent | ||
ApplyThisPrototype(event, this); | ||
return event; | ||
@@ -52,2 +54,2 @@ }; | ||
} | ||
})(); | ||
})(require('./ApplyThisPrototype.js')); |
@@ -1,2 +0,2 @@ | ||
(function() { | ||
(function(ApplyThisPrototype) { | ||
/** | ||
@@ -57,2 +57,4 @@ * Polyfill PointerEvent | ||
ApplyThisPrototype(event, this); | ||
return event; | ||
@@ -70,2 +72,2 @@ }; | ||
} | ||
})(); | ||
})(require('./ApplyThisPrototype.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
96782
20
1933