3 <style type=
"text/css">
5 #console { color: black
; }
9 function resultStringifier(result
)
13 else if (result
=== undefined)
14 return "<b>undefined</b>";
15 else if (result
=== null)
17 return "\"" + result
+ "\"";
20 function printOut(expect
, res
) {
21 var console
= document
.getElementById("console");
22 var span
= document
.createElement('span');
24 var a
= resultStringifier(expect
);
25 var b
= resultStringifier(res
);
27 span
.innerHTML
+= "PASS: Got " + b
+ " as expected.<br>";
29 span
.innerHTML
+= "FAIL: Got " + b
+ " but was expecting " + a
+ "<br>";
30 console
.appendChild(span
);
34 if (window
.testRunner
)
35 testRunner
.dumpAsText();
37 var rules
= document
.styleSheets
[0].cssRules
;
38 var mediaList
= rules
.item(0).media
;
40 printOut("screen", mediaList
.mediaText
);
42 mediaList
.mediaText
= null;
43 printOut("", mediaList
.mediaText
);
45 mediaList
.mediaText
= "screen"
46 mediaList
.mediaText
= ",,all,,";
47 printOut("not all, not all, all, not all, not all", mediaList
.mediaText
);
49 mediaList
.mediaText
= ",,all,, ";
50 printOut("not all, not all, all, not all, not all", mediaList
.mediaText
);
54 mediaList
.mediaText
= ",screen,,&invalid,,";
58 printOut("not all, screen, not all, not all, not all, not all", mediaList
.mediaText
);
62 mediaList
.mediaText
= ",screen,,(invalid,),,";
66 printOut("not all, screen, not all, not all, not all, not all", mediaList
.mediaText
);
70 mediaList
.mediaText
= ",(all,),,";
74 printOut("not all, not all, not all, not all", mediaList
.mediaText
);
78 <body onload=
"runTests()">
79 <div id=
"console"></div>