| <!DOCTYPE html> |
| <pre id="console"> |
| </pre> |
| <script> |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| function log(message) |
| { |
| document.getElementById('console').appendChild(document.createTextNode(message + "\n")); |
| } |
| |
| function testQuery(query, expected) |
| { |
| var actual = window.styleMedia.matchMedium(query); |
| var message = (actual === expected) ? 'PASS' : 'FAIL'; |
| message += ": \"" + query + "\" evaluates to " + (actual ? "true" : "false") + "."; |
| log(message); |
| } |
| |
| testQuery('(min-device-width: 0)', true); |
| testQuery('(min-device-width: 1px)', true); |
| testQuery('(min-device-width: 1deg)', false); |
| testQuery('(min-device-width: 1)', false); |
| testQuery('(min-device-width: solid)', false); |
| testQuery('(min-device-width: "red")', false); |
| </script> |