<html> <head> <title>required/optional CSS pseudoclasses part 5</title> <script src="../../resources/js-test.js"></script> <style> input:optional { background: lime; } input { background: red; } input:required { background: red; } </style> </head> <body> <input id="range" type="range" required/> <input id="submit" type="submit" required/> <input id="image" type="image" required/> <input id="reset" type="reset" required/> <input id="button" type="button" required/> <script language="JavaScript" type="text/javascript"> function isOptional(id) { return document.defaultView.getComputedStyle(document.getElementById(id), null).getPropertyValue('background-color') == "rgb(0, 255, 0)" } description('This test checks the CSS pseudoclasses for input types.'); shouldBeTrue('isOptional("range")'); shouldBeTrue('isOptional("submit")'); shouldBeTrue('isOptional("image")'); shouldBeTrue('isOptional("reset")'); shouldBeTrue('isOptional("button")'); </script> </body> </html>