polyfill dispatchEvent