Added a CustomEvent constructor with a createEvent fallback