summaryrefslogtreecommitdiffstats
path: root/layout/reftests/forms/select/out-of-bounds-selectedindex.html
blob: 4ae9ed06b6ccfd447a1044e046944b003c1b4079 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<html class="reftest-wait">
<head><title>Testcase for bug 471741</title>
<script>
var result = "Result: "
function sel(id,index) {
  var el = document.getElementById(id)
  el.selectedIndex = index;
  result += el.selectedIndex + ' ';
}

</script>
</head>
<body id="body">
<select size="4" id="m1" multiple="multiple">
	<option value="Item0">Item0</option>
	<option selected="selected" value="Item1">Item1</option>
	<option value="Item2">Item2</option>
	<option value="Item3">Item3</option>
	<option value="Item4">Item4</option>
</select>
<select size="1" id="s1">
	<option value="Item0">Item0</option>
	<option selected="selected" value="Item1">Item1</option>
	<option value="Item2">Item2</option>
	<option value="Item3">Item3</option>
	<option value="Item4">Item4</option>
</select>

<select size="4" id="m2" multiple="multiple">
	<option value="Item0">Item0</option>
</select>
<select size="1" id="s2">
	<option value="Item0">Item0</option>
</select>

<select size="4" id="m3" multiple="multiple"></select>
<select size="1" id="s3"></select>
<br>

<select size="4" id="r2m1" multiple="multiple">
	<option value="Item0">Item0</option>
	<option selected="selected" value="Item1">Item1</option>
	<option value="Item2">Item2</option>
	<option value="Item3">Item3</option>
	<option value="Item4">Item4</option>
</select>
<select size="1" id="r2s1">
	<option value="Item0">Item0</option>
	<option selected="selected" value="Item1">Item1</option>
	<option value="Item2">Item2</option>
	<option value="Item3">Item3</option>
	<option value="Item4">Item4</option>
</select>

<select size="4" id="r2m2" multiple="multiple">
	<option value="Item0">Item0</option>
</select>
<select size="1" id="r2s2">
	<option value="Item0">Item0</option>
</select>

<select size="4" id="r2m3" multiple="multiple"></select>
<select size="1" id="r2s3"></select>
<br>

<select size="4" id="r3m1" multiple="multiple">
	<option value="Item0">Item0</option>
	<option selected="selected" value="Item1">Item1</option>
	<option value="Item2">Item2</option>
	<option value="Item3">Item3</option>
	<option value="Item4">Item4</option>
</select>
<select size="1" id="r3s1">
	<option value="Item0">Item0</option>
	<option selected="selected" value="Item1">Item1</option>
	<option value="Item2">Item2</option>
	<option value="Item3">Item3</option>
	<option value="Item4">Item4</option>
</select>

<select size="4" id="r3m2" multiple="multiple">
	<option value="Item0">Item0</option>
</select>
<select size="1" id="r3s2">
	<option value="Item0">Item0</option>
</select>

<select size="4" id="r3m3" multiple="multiple"></select>
<select size="1" id="r3s3"></select>
<br>

<div id="result"></div>

<script>
sel('m1', 10)
sel('s1', 10)
sel('m2', 99999)
sel('s2', 99999)
sel('m3', 10)
sel('s3', 10)

sel('r2m1', -2)
sel('r2s1', -2)
sel('r2m2', -12)
sel('r2s2', -12)
sel('r2m3', -2)
sel('r2s3', -2)

sel('r3m1', -2)
sel('r3s1', -2)
sel('r3m2', -12)
sel('r3s2', -12)
sel('r3m3', -2)
sel('r3s3', -2)
sel('r3m1', 0)
sel('r3s1', 0)
sel('r3m2', 0)
sel('r3s2', 0)
sel('r3m3', 0)
sel('r3s3', 0)

document.getElementById('result').innerHTML = result;

var flush = document.documentElement.offsetHeight;
document.documentElement.className='';

</script>
</body>
</html>