blob: 736ece2e765098eadce4c9d0c4064175a79bc536 (
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
|
<!DOCTYPE html>
<script src="../../js/resources/js-test-pre.js"></script>
<script>
jsTestIsAsync = true;
description('Test usage of document.currentScript with async')
var seenIds = [];
function logCurrentScript(id) {
// Don't print anything if pass since the execution order of script[async]
// is non deterministic.
if (id !== document.currentScript.id)
shouldBeEqualToString('document.currentScript.id', id);
seenIds.push(document.currentScript.id);
seenIds.sort();
if (seenIds.join('') === expectedIds)
finishJSTest();
}
var expectedIds = 'abcdef';
</script>
<script id="a">
logCurrentScript('a');
</script>
<script id="b" async src="resources/log-current-script-b.js"></script>
<script id="c">
logCurrentScript('c');
</script>
<script id="d" async src="resources/log-current-script-d.js"></script>
<script id="e">
logCurrentScript('e');
var script = document.createElement('script');
script.id = 'f'
script.async = true;
script.defer = false;
script.src = 'resources/log-current-script-f.js';
document.head.appendChild(script);
</script>
</body>
</html>
|