Closed aliuk2012 closed 4 years ago
Nice! I have been using
document.addEventListener('DOMContentLoaded', function() {
// stuff
});
as a vanilla alternative but if you’re sure everything loads in the right order then 👌
I've bumped this ready to merge, I think some newer changes (probably move to the Design System) moved the script location anyway so this feels good to merge.
Hmm this approach no longer seems to work anymore, going to close for now, will be revisited when/if we remove jQuery. Thanks for the help anyway.
This is part of a bigger piece of work to remove the dependency on jQuery.
There is no need to rely on jQuery's document.ready() method. By placing application.js at the bottom of the page, the script will be executed after all preceding DOM is loaded anyway.
There is also a slight performance improvement (HTML parsing and loading of CSS and images isn't blocked by the scripts)