import { getDocument } from "./getDocument" ; example export function createEvent ( element , type , eventInit ? ) { if ( typeof Event === "function" ) { return new Event ( type , eventInit ) ; } const event = getDocument ( element ) . createEvent ( "Event" ) ; event . initEvent ( type , eventInit ?. bubbles , eventInit ?. cancelable ) ; return event ; }