From one man who currently works on Google I saw code which looks similar to this:
$(document).bind('ready load', function() { ... });
There are 2 intertwined questions:
Since I'm only novice in JS, I don't understand the purpose of this binding. Why we need both
ready
andload
? I tend to think that sometimes we needready
, sometimesload
, but not both.Also, I tend to think that
ready
is fordocument
, andload
is forwindow
. That's mean:$(document).ready(function() { ... }); $(window).load(function() { ... });
But from the first snippet, it could be seen, that both
ready
andload
are used fordocument
. So, my assumption (ready
is fordocument
, andload
is forwindow
) isn't correct?