Fix CustomEvent polyfill, at least on Safari