summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/old-tests/submission/Opera/script_scheduling/103.html
blob: 198c394dee9a2b4ff578626077f132fb213dc972 (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
<!DOCTYPE html>
<html><head>
	<title> scheduler: removing defer attribute at runtime</title>
	<script src="/resources/testharness.js"></script>
	<script src="/resources/testharnessreport.js"></script>
	<script src="testlib/testlib.js"></script>
</head>
<body>

        <div id="test"></div>
	<div id="log">FAILED (This TC requires JavaScript enabled)</div>

        <script id="defer-script" defer src="scripts/include-2.js"></script> 
        <script src="scripts/include-1.js"></script>

	<script>
          var t = async_test();

          t.step(function() {
            document.getElementById("defer-script").removeAttribute("defer");
          });

          var ran_defer_check = false;

          document.addEventListener("readystatechange", t.step_func(function () {
            if (document.readyState == "interactive") {
              ran_defer_check = true;
              assert_array_equals(eventOrder, ["external script #1"]);
            }
          }), false);

          addEventListener("load", t.step_func(function () {
            assert_true(ran_defer_check);
            assert_array_equals(eventOrder, ["external script #1", "external script #2"]);
            t.done();
          }), false);
          
        </script>
</body></html>