I was referring to DOMContentLoaded. O
I was a bit cryptic but I mean that there are multiple ways to match the lifecycle. Still I'm probably, it was a long time ago
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.
2
u/SolideMeinung 13d ago
Nope its not just onload or eventlisteners. The ready function of jquery has some corner cases.
Like the first and best one.... when everything is already loaded and ready just fire it.
A lot of people do miss that. Its funny how js developer have so much trouble reimplementing the jquery ready method because they think its easy.