Add CustomEvent constructor polyfill

This change makes IE9+ and older WebKit and Gecko versions compatible with using `new CustomEvent()`.

One particular case where we needed this was on Android, as versions prior to 4.4 support custom events, but do not support the `CustomEvent` constructor.

The original polyfill was from [MDN](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill), but I've attempted to match your code style (and that of the CustomEvent constructor for older IE versions).