title: Defer attribute and onload event
body: <p>Having the code below:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;  
  
          &lt;script&gt;            
              function elem_onload() {
                  console.log("elem_onload");
              };      
          &lt;/script&gt;
  
      &lt;/head&gt;
  
      &lt;body onload="elem_onload()"&gt;       
          &lt;script type="text/javascript" src="script.js" defer&gt;&lt;/script&gt;      
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>script.js:</p>
  
  <pre><code>console.log("external script");
  </code></pre>
  
  <p>the defer attribute doesn't seems to work. The output is:</p>
  
  <pre><code>external script
  elem_onload
  </code></pre>
  
  <p>whether with or without defer attribute. Shoudn't it be </p>
  
  <pre><code>elem_onload
  external script 
  </code></pre>
  
  <p>with defer defined?</p>
  
  <h1>Duplicated answer!?</h1>
  
  <p>I'd like to state that my answer isn't duplicate of </p>
  
  <p><a href="https://stackoverflow.com/questions/5250412/how-exactly-does-script-defer-defer-work">How exactly does &lt;script defer=“defer”&gt; work?</a></p>
  
  <p>The referenced recommended answer is about inline script where the browser behavior is clear for me - it simply ignores <code>defer</code>. My question is about external script in which case the browser should execute the external deferred script </p>
  
  <blockquote>
    <p>after the document has been parsed</p>
  </blockquote>
  
  <p>as documentation states hence after <code>onload</code> event.</p>
  
  <p><strong>So I'm waiting for an appropriate answer...</strong></p>