Reputation: 14931
Well wait. What if the script is big and actually does not get loaded until AFTER the domloaded event in the browser? waiting for the domloaded event would lead to waiting forever. Or am I missunderstanding something?
I am actually using jquery for the ondomready event instead of their module. Do I have to worry about slow connections?
Upvotes: 0
Views: 50
Reputation: 151401
Both the domReady
plugin and jQuery will detect if the page has already finished loading (i.e. if the DOMContentLoaded
event has already happened). In this case, they will execute their callbacks right away. I've used them and never had a case where my code waited forever.
So you don't have to worry that a slow connection will cause them to wait forever.
If you believe you have encountered a case where they would wait forever, then please provide the details to reproduce it.
Upvotes: 1