He means the script is loaded and run before the DOM was rendered. Bit of a stretch calling that hydration, because you usually only would call it that if the HTML was prepared via SSR or SSG, not if its a fully static HTML from the start. And even if it would be applicable, its not about the rock not having been hydrated yet but it not having rendered yet, so the "hydration" fails because of it.
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.
79
u/grimonce 2d ago
This has never been an issue with jQuery lol