document.createEvent is deprecated