Use CustomEvent if supported and initEvent as fallback