Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<head>
<title>CSS Test: the MediaList interface</title>
<link rel="author" title="Ms2ger" href="mailto:Ms2ger@gmail.com"/>
<style media="screen, print" id="test-style"></style>
<script src="/resources/testharness.js"/>
<script src="/resources/testharnessreport.js"/>
</head>
<body>
<div id="log"/>
<script>
test(function() {
var ss = document.styleSheets[0];
assert_equals(ss.ownerNode.id, "test-style", "Got the wrong style element");
var media = ss.media;
test(function() {
assert_equals(media.mediaText, "screen, print", "Serialization should be \"screen, print\"");
}, "MediaList.mediaText");
test(function() {
assert_equals(media.length, 2, "Got wrong number of media");
}, "MediaList.length");
test(function() {
assert_equals(media[-1], undefined, "media[-1] should return undefined");
assert_equals(media[0], "screen", "media[0] should return \"screen\"");
assert_equals(media[1], "print", "media[1] should return \"print\"");
assert_equals(media[2], undefined, "media[2] should return undefined");
}, "MediaList getter");
test(function() {
assert_equals(media.item(-1), null, "media.item(-1) should return null");
assert_equals(media.item(0), "screen", "media.item(0) should return \"screen\"");
assert_equals(media.item(1), "print", "media.item(1) should return \"print\"");
assert_equals(media.item(2), null, "media.item(2) should return null");
}, "MediaList.item");
}, "MediaList");
</script>
</body>
</html>