summaryrefslogtreecommitdiffstats
path: root/layout/reftests/bugs/84400-1.html
blob: bfdf471660f14dbafde09f79c69083920584da00 (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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
                      "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Testing controls that should match :enabled/:disabled</title>
    <style type="text/css">
      input, textarea, button, *.hideme { display: none; }
      div { margin-bottom: 0.2em; }

      span, option, optgroup { background-color: red; }
      *:enabled + span.true, option.true:enabled, optgroup.true:enabled { color: lime; background-color: lime; }
      *:disabled + span.false, option.false:disabled, optgroup.false:disabled { color: lime; background-color: lime; }
    </style>
    <script type="text/javascript">
      // Runs through i1, i2, .... in and toggles the |disabled| attribute
      function onLoad() {
        var i = 1;
	var el = document.getElementById("i1");
	while (el) {
	  if (el.hasAttribute("disabled")) {
	    el.removeAttribute("disabled");
	  } else {
	    el.setAttribute("disabled", "disabled");
	  }
	  ++i;
	  el = document.getElementById("i" + i);
	}
	if (i != 31) {
	  alert("onLoad() handler failed!");
	}
      }

      window.addEventListener("load", onLoad, false);
    </script>
  </head>
  <body>
    <div>
      There should be no red in the following (note: form styling should be enabled).
    </div>

    <form method="get" action=".">
      <div>
	input:
	<input/> <span class="true">FAIL</span>
	<input disabled="disabled"/> <span class="false">FAIL</span>
	<input id="i1"/> <span class="false">FAIL</span>
	<input id="i2" disabled="disabled"/> <span class="true">FAIL</span>
      </div>

      <div>
	password:
	<input type="password"/> <span class="true">FAIL</span>
	<input type="password" disabled="disabled"/> <span class="false">FAIL</span>
	<input type="password" id="i3"/> <span class="false">FAIL</span>
	<input type="password" id="i4" disabled="disabled"/> <span class="true">FAIL</span>
      </div>

      <div>
	checkbox:
	<input type="checkbox"/> <span class="true">FAIL</span>
	<input type="checkbox" disabled="disabled"/> <span class="false">FAIL</span>
	<input type="checkbox" id="i5"/> <span class="false">FAIL</span>
	<input type="checkbox" id="i6" disabled="disabled"/> <span class="true">FAIL</span>
      </div>

      <div>
	radio:
	<input type="radio"/> <span class="true">FAIL</span>
	<input type="radio" disabled="disabled"/> <span class="false">FAIL</span>
	<input type="radio" id="i7"/> <span class="false">FAIL</span>
	<input type="radio" id="i8" disabled="disabled"/> <span class="true">FAIL</span>
      </div>

      <div>
	submit:
	<input type="submit"/> <span class="true">FAIL</span>
	<input type="submit" disabled="disabled"/> <span class="false">FAIL</span>
	<input type="submit" id="i9"/> <span class="false">FAIL</span>
	<input type="submit" id="i10" disabled="disabled"/> <span class="true">FAIL</span>
      </div>

      <div>
	reset:
	<input type="reset"/> <span class="true">FAIL</span>
	<input type="reset" disabled="disabled"/> <span class="false">FAIL</span>
	<input type="reset" id="i11"/> <span class="false">FAIL</span>
	<input type="reset" id="i12" disabled="disabled"/> <span class="true">FAIL</span>
      </div>

      <div>
	file:
	<input type="file"/> <span class="true">FAIL</span>
	<input type="file" disabled="disabled"/> <span class="false">FAIL</span>
	<input type="file" id="i13"/> <span class="false">FAIL</span>
	<input type="file" id="i14" disabled="disabled"/> <span class="true">FAIL</span>
      </div>

      <div>
	hidden:
	<input type="hidden"/> <span class="true">FAIL</span>
	<input type="hidden" disabled="disabled"/> <span class="false">FAIL</span>
	<input type="hidden" id="i15"/> <span class="false">FAIL</span>
	<input type="hidden" id="i16" disabled="disabled"/> <span class="true">FAIL</span>
      </div>

      <div>
	image:
	<input type="image"/> <span class="true">FAIL</span>
	<input type="image" disabled="disabled"/> <span class="false">FAIL</span>
	<input type="image" id="i17"/> <span class="false">FAIL</span>
	<input type="image" id="i18" disabled="disabled"/> <span class="true">FAIL</span>
      </div>

      <div>
	button (input):
	<input type="button"/> <span class="true">FAIL</span>
	<input type="button" disabled="disabled"/> <span class="false">FAIL</span>
	<input type="button" id="i19"/> <span class="false">FAIL</span>
	<input type="button" id="i20" disabled="disabled"/> <span class="true">FAIL</span>
      </div>

      <div>
	textarea:
	<textarea cols="5" rows="5"></textarea> <span class="true">FAIL</span>
	<textarea cols="5" rows="5" disabled="disabled"></textarea> <span class="false">FAIL</span>
	<textarea cols="5" rows="5" id="i21"></textarea> <span class="false">FAIL</span>
	<textarea cols="5" rows="5" id="i22" disabled="disabled"></textarea> <span class="true">FAIL</span>
      </div>

      <div>
	button:
	<button>bogus</button> <span class="true">FAIL</span>
	<button disabled="disabled">bogus</button> <span class="false">FAIL</span>
	<button id="i23">bogus</button> <span class="false">FAIL</span>
	<button id="i24" disabled="disabled">bogus</button> <span class="true">FAIL</span>
      </div>

      <div>
	select:
	<select class="hideme"><option>bogus</option></select> <span class="true">FAIL</span>
	<select class="hideme" disabled="disabled"><option>bogus</option></select> <span class="false">FAIL</span>
	<select class="hideme" id="i25"><option>bogus</option></select> <span class="false">FAIL</span>
	<select class="hideme" id="i26" disabled="disabled"><option>bogus</option></select> <span class="true">FAIL</span>

      </div>

      <div>
	option:
	<select size="4">
	  <option class="true">FAIL</option>
	  <option class="false" disabled="disabled">FAIL</option>
	  <option class="false" id="i27">FAIL</option>
	  <option class="true" id="i28" disabled="disabled">FAIL</option>
	</select>
      </div>

      <div>
	optgroup:
	<select size="4">
	  <optgroup class="true" label="FAIL">
	    <option class="hideme">bogus</option>
	  </optgroup>
	  <optgroup class="false" disabled="disabled" label="FAIL">
	    <option class="hideme">bogus</option>
	  </optgroup>
	  <optgroup class="false" id="i29" label="FAIL">
	    <option class="hideme">bogus</option>
	  </optgroup>
	  <optgroup class="true" disabled="disabled" id="i30" label="FAIL">
	    <option class="hideme">bogus</option>
	  </optgroup>
	</select>
      </div>

    </form>

  </body>
</html>