Manually dispatchEvent DOMContentLoaded

Since initEvent is deprecated here, it’s better to use Event constructor like this:

window.document.dispatchEvent(new Event("DOMContentLoaded", {
  bubbles: true,
  cancelable: true
}));

Leave a Comment