Skip to content

Instantly share code, notes, and snippets.

View simion314's full-sized avatar

Simion Ploscariu simion314

View GitHub Profile
@WebReflection
WebReflection / CustomEvent.js
Last active June 7, 2018 18:29
CustomEvent for IE8 or other old browsers that do not implement it. `new CustomEvent('type', {bubbles:true, detail:{what:'ever'}})`
try{new CustomEvent('?')}catch(o_O){
/*!(C) Andrea Giammarchi -- WTFPL License*/
this.CustomEvent = function(
eventName,
defaultInitDict
){
// the infamous substitute
function CustomEvent(type, eventInitDict) {
var event = document.createEvent(eventName);