Bootstrap applications without waiting for DOMContentLoaded
All of GitLab's javascript files are added to HTML with `defer` attribute, which, [according to documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script), implies: > the script is meant to be executed after the document has been parsed, but before firing DOMContentLoaded Since the document is already parsed, we do not need to wait for `DOMContentLoaded` to bootstrap applications because all the DOM nodes are already at our disposal. This might help significantly reduce loading performance on those hybrid views (HAML frame, containing Vue application) in particular. For exact views to be updated, check the child epics: - [Unwrap DOMContentLoaded handlers in app/ folder](https://gitlab.com/groups/gitlab-org/-/epics/4541) - [Unwrap DOMContentLoaded handlers in ee/ folder](https://gitlab.com/groups/gitlab-org/-/epics/4542) For more info on why `DOMContentLoaded` is no longer needed see https://gitlab.com/groups/gitlab-org/-/epics/4538#note_428033473 ## Caveats There is one thing to keep in mind when working on this, it's related to third party scripts being embed via a `script` tag. More information about this can be found in this [Issue](https://gitlab.com/gitlab-org/gitlab/-/issues/284997) and the according [MR](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49512) which fixes it.
epic