Simplified dispatchEvent and fixed custom event firing for IE9+ and standard compliant browsers