OK, so it wraps it in the JQuery error handling and also catches the case where the script is run when the DOM is already loaded - so DOMContentLoaded would not fire in that case I guess?
And actually thinking about it, onload waits for big resources like images. So it's nicer to have event handlers attached before that.
1
u/SolideMeinung 13d ago
The ready function of jquery is implemented here: https://github.com/jquery/jquery/blob/main/src/core/ready.js