37 lines
986 B
HTML
37 lines
986 B
HTML
<html>
|
|
<head>
|
|
<title>required/optional CSS pseudoclasses part 2</title>
|
|
<style>
|
|
input:optional { background: lime; }
|
|
textarea:optional { background: lime; }
|
|
input { background: red; }
|
|
textarea { background: red; }
|
|
</style>
|
|
<script language="JavaScript" type="text/javascript">
|
|
function log(message) {
|
|
document.getElementById("console").innerHTML += "<li>"+message+"</li>";
|
|
}
|
|
|
|
function test() {
|
|
if (window.testRunner)
|
|
testRunner.dumpAsText();
|
|
|
|
v = document.getElementsByName("victim");
|
|
|
|
for (i = 0; i < v.length; i++)
|
|
if (document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') == "rgb(0, 255, 0)")
|
|
log("SUCCESS");
|
|
else
|
|
log("FAILURE");
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="test()">
|
|
<p>All controls should have a green background.</p>
|
|
<input name="victim"/>
|
|
<textarea name="victim" /></textarea>
|
|
<hr>
|
|
<ol id="console"></ol>
|
|
</body>
|
|
</html>
|