After reading about the defer attribute at mdn
This Boolean attribute is set to indicate to a browser that the script
is meant to be executed after the document has been parsed.
It looks nice.
So I’ve tested it against $(function () { }); and $(window).load(...)
<script>
$(function ()
{
alert('1')
});
$(window).load(function ()
{
alert('2')
});
</script>
<script defer="defer">
alert('4');
</script>
This code Always output 4,1,2 !
Ok So now I can recognize the time where the document is parsed.
In what scenarious will i need the stage before document.ready (where the parse time complete) ?
From MDN
The actual use would be that you can still have scripts at the top of the page and make the browser load them after the entire page is parsed fully thus improving the client side of the performance.
From YSlow