chromium/third_party/blink/web_tests/fast/dom/HTMLScriptElement/script-async-attr.html

<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>

<script id="s0" src="ignored.js"></script>
<script id="s1" src="ignored.js" async></script>
<script id="s2" src="ignored.js" async="async"></script>
<script id="s3" src="ignored.js" async="ASYNC"></script>
<script id="s4" src="ignored.js" async="true"></script>
<script id="s5" src="ignored.js" async="false"></script>
<script id="s6"></script>
<script id="s7" async></script>
<script id="s8" async></script>

<script>
description('This test checks for proper parsing of the async attribute on HTML script tags.');

var nextScriptID = 9;

function isAsync(id)
{
    return document.getElementById(id).async;
}

function isDynamicallyInsertedScriptAsync(async)
{
    var id = "s" + nextScriptID++;
    var script = document.createElement("script");
    script.id = id;
    script.src = "resources/script-load.js";
    if (async != null)
        script.async = async;
    document.getElementsByTagName("head")[0].appendChild(script);
    return isAsync(id);
}

document.getElementById("s8").removeAttribute("async");

shouldBeFalse("isAsync('s0')");
shouldBeTrue("isAsync('s1')");
shouldBeTrue("isAsync('s2')");
shouldBeTrue("isAsync('s3')");
shouldBeTrue("isAsync('s4')");
shouldBeTrue("isAsync('s5')");
shouldBeTrue("isAsync('s6')");
shouldBeTrue("isAsync('s7')");
shouldBeFalse("isAsync('s8')");
shouldBeTrue("isDynamicallyInsertedScriptAsync(true)");
shouldBeFalse("isDynamicallyInsertedScriptAsync(false)");
shouldBeTrue("isDynamicallyInsertedScriptAsync(\"async\")");
shouldBeTrue("isDynamicallyInsertedScriptAsync(null)");
</script>
</body>
</html>