3 <title>required/optional CSS pseudoclasses part
4</title>
5 button:optional { background: lime; }
6 input:optional { background: lime; }
7 select:optional { background: lime; }
8 textarea:optional { background: lime; }
9 button { background: red; }
10 input { background: red; }
11 select { background: red; }
12 textarea { background: red; }
13 button:required { background: red; }
14 input:required { background: red; }
15 select:required { background: red; }
16 textarea:required { background: red; }
18 <script language=
"JavaScript" type=
"text/javascript">
19 function log(message
) {
20 document
.getElementById("console").innerHTML
+= "<li>"+message
+"</li>";
24 if (window
.testRunner
)
25 testRunner
.dumpAsText();
27 v
= document
.getElementsByName("victim");
29 for (i
= 0; i
< v
.length
; i
++)
30 if (document
.defaultView
.getComputedStyle(v
[i
], null).getPropertyValue('background-color') == "rgb(0, 255, 0)")
37 <body onload=
"test()">
38 <p>All controls should have a green background.
</p>
39 <button type=
"button" name=
"victim">Lorem ipsum
</button>
40 <input name=
"victim" disabled
/>
41 <input type=
"button" name=
"victim"/>
42 <select name=
"victim"></select>
43 <textarea name=
"victim"></textarea>
45 <ol id=
"console"></ol>