Fixed CustomEvent

The `CustomEvent` constructor lives on `window` and not on `document`.