summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/module/script-for-event.html
blob: e3b8e15b414451f22b643f3f07730b265781c2e2 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<title>Module scripts with for and event attributes</title>
<link rel="author" title="Matheus Kerschbaum" href="mailto:matjk7@gmail.com">
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#prepare-a-script">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var expected = [
  true,
  true,
  true,
  true,
  true,
  true,
  true,
  true,
  true,
  true,
  true,
  true,
  true,
  true,
  true,
  true,
  true,
];
var run = expected.map(function() { return false });
</script>
<script for="w&#x130;ndow" event="onload" type="module">
run[0] = true;
</script>
<script for="window" event="onload x" type="module">
run[1] = true;
</script>
<script for="window" event="onload(x" type="module">
run[2] = true;
</script>
<script for="window" event="onload(x)" type="module">
run[3] = true;
</script>
<script for="window" event="onclick" type="module">
run[4] = true;
</script>
<script for="" event="onload" type="module">
run[5] = true;
</script>
<script for="window" event="" type="module">
run[6] = true;
</script>
<script for="" event="" type="module">
run[7] = true;
</script>
<script for="&#xa0;window" event="onload" type="module">
run[8] = true;
</script>
<script for="window&#xa0;" event="onload" type="module">
run[9] = true;
</script>
<script for="window" event="&#xa0;onload" type="module">
run[10] = true;
</script>
<script for="window" event="onload&#xa0;" type="module">
run[11] = true;
</script>
<script for=" window " event=" onload " type="module">
run[12] = true;
</script>
<script for=" window " event=" onload() " type="module">
run[13] = true;
</script>
<script for="object" event="handler" type="module">
run[14] = true;
</script>
<script event="handler" type="module">
run[15] = true;
</script>
<script for="object" type="module">
run[16] = true;
</script>
<script type="module">
test(function() {
  for (var i = 0; i < run.length; ++i) {
    test(function() {
      var script = document.querySelectorAll("script[for], script[event]")[i];
      assert_equals(run[i], expected[i],
                    "script for=" + format_value(script.getAttribute("for")) +
                    " event=" + format_value(script.getAttribute("event")));
    }, "Script " + i);
  }
});
</script>