blob: 7d6053cfe740632b294553c38608412ba39f701a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
<html>
<head>
<link rel="stylesheet" href="../../js/resources/js-test-style.css">
<script src="../../js/resources/js-test-pre.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)");
var successfullyParsed = true;
</script>
<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
|