document.createEvent is deprecated
https://developer.mozilla.org/en-US/docs/Web/API/document.createEvent