Fix for IE11 not supporting CustomEvent constructor

This fixes an error in IE11, where `window.CustomEvent` is present, for whatever reason, but defined as an object (see http://msdn.microsoft.com/en-us/library/ie/ff974338%28v=vs.85%29.aspx).