Fixed error in CustomEvent polyfill for Safari