chromium/third_party/blink/web_tests/fast/media/mq-js-stylesheet-media-03.html

<html>
<head>
<title>CSS3 media query test: stylesheet media.appendMedium</title>
<link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/#syntax" />
<link rel="help" href="http://www.w3.org/TR/DOM-Level-2-Style/stylesheets.html" />
<style type="text/css" media="braille, not screen">
p { color: green }
</style>

<script language="javascript">
function test() {
    var re = document.getElementById("result");
    var media = document.styleSheets[0].media;
    media.appendMedium("screen and (color)");
    media.appendMedium("not screen");
    var first = true;
    for (var i = 0; i < media.length; ++i) {
        if (!first)  re.innerHTML += ", " + media.item(i);
        else re.innerHTML = media.item(i);
        first = false;
    }

}
</script>

</head>
<body onload="test()">
<!-- FIXME: NOTE! This will fail until dynamic setting of media property causes style recalculation.
          This is not the case currently (24.07.2005)
-->
<p> This text should be green and below should read "braille, not screen, screen and (color)". </p>
<p id="result">Failure: test not run</p>
</body>
</html>