polyfill-service
Version:
A polyfill combinator
1 lines • 2.17 kB
JSON
{"aliases":["default","modernizr:customevent"],"browsers":{"firefox":"6 - 10","ie":"*","ie_mob":"10 - *","opera":"10 - 11.5","safari":"4 - 7","chrome":"1 - 14","android":"<=4.3","firefox_mob":"6 - 10"},"dependencies":["Event"],"spec":"http://dom.spec.whatwg.org/#interface-customevent","docs":"https://developer.mozilla.org/en/docs/Web/API/CustomEvent","baseDir":"CustomEvent","hasTests":true,"rawSource":"\n// CustomEvent\nthis.CustomEvent = function CustomEvent(type, eventInitDict) {\n\tif (!type) {\n\t\tthrow Error('TypeError: Failed to construct \"CustomEvent\": An event name must be provided.');\n\t}\n\n\tvar event;\n\teventInitDict = eventInitDict || {bubbles: false, cancelable: false, detail: null};\n\n\tif ('createEvent' in document) {\n\t\ttry {\n\t\t\tevent = document.createEvent('CustomEvent');\n\t\t\tevent.initCustomEvent(type, eventInitDict.bubbles, eventInitDict.cancelable, eventInitDict.detail);\n\t\t} catch (error) {\n\t\t\t// for browsers which don't support CustomEvent at all, we use a regular event instead\n\t\t\tevent = document.createEvent('Event');\n\t\t\tevent.initEvent(type, eventInitDict.bubbles, eventInitDict.cancelable);\n\t\t\tevent.detail = eventInitDict.detail;\n\t\t}\n\t} else {\n\n\t\t// IE8\n\t\tevent = new Event(type, eventInitDict);\n\t\tevent.detail = eventInitDict && eventInitDict.detail || null;\n\t}\n\treturn event;\n};\n\nCustomEvent.prototype = Event.prototype;\n","minSource":"this.CustomEvent=function(e,t){if(!e)throw Error('TypeError: Failed to construct \"CustomEvent\": An event name must be provided.');var n;if(t=t||{bubbles:!1,cancelable:!1,detail:null},\"createEvent\"in document)try{n=document.createEvent(\"CustomEvent\"),n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail)}catch(l){n=document.createEvent(\"Event\"),n.initEvent(e,t.bubbles,t.cancelable),n.detail=t.detail}else n=new Event(e,t),n.detail=t&&t.detail||null;return n},CustomEvent.prototype=Event.prototype;","detectSource":"'CustomEvent' in this &&\n\n// In Safari, typeof CustomEvent == 'object' but it otherwise works fine\n(typeof this.CustomEvent === 'function' ||\n(this.CustomEvent.toString().indexOf('CustomEventConstructor')>-1))"}