Use the `CustomEvent` constructor instead of `document.createEvent`.
Merge pull request #2 from KenPowers/patch-1

Use the `CustomEvent` constructor instead of `document.createEvent`.