async/defer attributes and DOM construction

6. script with defer (IE bug)

Result

Hello World!

Markup

<p id="result">
    Hello
    <script src="D.js" defer></script>
    <script src="E.js" defer></script>
    <script src="F.js" defer></script>
    World!
</p>

DOM elements and Events

Description

A bug of IE9- was reported in script[defer] doesn’t work in IE<=9 when jquery.js and jquery-ui.js are included into the page with defer attribute. Here is the similar demo but more simplified.

Injecting some HTMLs into the DOM element through innerHTML may cause this bug. In this demo, it seems that JavaScript engine may stall at somewhere if D.js, E.js and F.js will do as follows:

document.getElementById('result').innerHTML += 'D';