Why does window.onload event occur before $(document).ready?
<p>As stated in this thread: <a href="https://stackoverflow.com/questions/3698200/window-onload-vs-document-ready">window.onload vs $(document).ready()</a>. The <code>window.onload</code> should occur later than the <code>$(document).ready()</code> but in this simple code the log would show that the <code>onload</code> event is executed before the ready event? What I'm I missing here?</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;

&lt;head&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
  &lt;h1&gt;A Simple Site&lt;/h1&gt;
  &lt;script&gt;
    $(document).ready(function() {
      console.log("ready event fired");
    })
     window.onload = function() {
      console.log("onload event fired");
    }
  &lt;/script&gt;
&lt;/body&gt;

&lt;/html&gt;</code></pre>
</div>
</div>
</p>