3 <title>required/optional CSS pseudoclasses
</title>
5 input:required { background: lime; }
6 textarea:required { background: lime; }
7 input { background: red; }
8 textarea { background: red; }
9 input:optional { background: red; }
10 textarea:optional { background: red; }
12 <script language=
"JavaScript" type=
"text/javascript">
13 function log(message
) {
14 document
.getElementById("console").innerHTML
+= "<li>"+message
+"</li>";
18 if (window
.testRunner
)
19 testRunner
.dumpAsText();
21 v
= document
.getElementsByName("victim");
23 for (i
= 0; i
< v
.length
; i
++)
24 if (document
.defaultView
.getComputedStyle(v
[i
], null).getPropertyValue('background-color') == "rgb(0, 255, 0)")
31 <body onload=
"test()">
32 <p>All controls should have a green background.
</p>
33 <input name=
"victim" required
/>
34 <textarea name=
"victim" required
/></textarea>
36 <ol id=
"console"></ol>