This feature detection logic seems wrong to me. Aren't event constructors the new feature, so we'll always detect and use document.createEvent? It seems we should detect the Event constructor first, and then fallback to createEvent. I don't know if there's a recommended way to detect event constructors. Maybe just try { new Event('close') } catch() { ... }