blob: a5f684c0c75258b938bfeb6ab88dbcdf35a73218 [file] [log] [blame]
<title>CSS3 media query test: deleteMedium throwing exception.</title>
<link rel="help" href="" />
<style type="text/css">
@media all and (color) {
p#result { color: green;}
<script language="javascript">
function test() {
try {
document.styleSheets[0].cssRules[0].media.deleteMedium("all and (");
document.getElementById("result").innerHTML = "Failure. 'all and (' is not a valid media query and should become 'not all'. Not all is not present in the media rule, hence a DOMException.NOT_FOUND_ERR should be thrown."
catch(e) {
if (e.code == DOMException.NOT_FOUND_ERR)
document.getElementById("result").innerHTML = "Success. This text should be green.";
else {
document.getElementById("result").innerHTML = "Failure. Wrong exception thrown. Expected DOMException.NOT_FOUND_ERR.";
document.getElementById("details").innerHTML = "Following exception was caught: " + e;
<body onload="test()">
<p>The text below should read "Success." </p>
<p id="result">Failure: test not run.</p>
<p id="details"></p>