| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 | 2 |
| 3 <html> | 3 <html> |
| 4 <head> | 4 <head> |
| 5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | 5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6 <title>CSSMediaRule functions test</title> | 6 <title>CSSMediaRule functions test</title> |
| 7 <style id="style1"> | 7 <style id="style1"> |
| 8 @media all { .test { color: green; } } | 8 @media all { .test { color: green; } } |
| 9 </style> | 9 </style> |
| 10 <script> | 10 <script> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 log("FAIL: an exception should have been thrown!"); | 59 log("FAIL: an exception should have been thrown!"); |
| 60 } catch (e) { | 60 } catch (e) { |
| 61 if (e.code == 12) | 61 if (e.code == 12) |
| 62 log("PASS: Exception raised successfully. Type: " + e); | 62 log("PASS: Exception raised successfully. Type: " + e); |
| 63 else | 63 else |
| 64 log("FAIL: wrong exception type thrown. " + e + " was th
rown, should of been Error: SyntaxError: DOM Exception 12!"); | 64 log("FAIL: wrong exception type thrown. " + e + " was th
rown, should of been Error: SyntaxError: DOM Exception 12!"); |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Test that insertRule raises an exception for illegally placed
rules. | 67 // Test that insertRule raises an exception for illegally placed
rules. |
| 68 try { | 68 try { |
| 69 // NamespaceRule illegal inside a MediaRule. |
| 70 var index = mediaRule.insertRule("@namespace mynamespace url
(http://www.w3.org/1999/xhtml);", mediaRule.cssRules.length); |
| 71 log("FAIL: an exception should have been thrown!"); |
| 72 } catch (e) { |
| 73 if (e.code == 3) |
| 74 log("PASS: Exception raised successfully. Type: " + e); |
| 75 else |
| 76 log("FAIL: wrong exception type thrown. " + e.code + " w
as thrown, should of been Error: HierarchyRequestError: DOM Exception 3!"); |
| 77 } |
| 78 try { |
| 69 // ImportRule illegal inside a MediaRule. | 79 // ImportRule illegal inside a MediaRule. |
| 70 var index = mediaRule.insertRule("@import url(sheet.css);",
mediaRule.cssRules.length); | 80 var index = mediaRule.insertRule("@import url(sheet.css);",
mediaRule.cssRules.length); |
| 71 log("FAIL: an exception should have been thrown!"); | 81 log("FAIL: an exception should have been thrown!"); |
| 72 } catch (e) { | 82 } catch (e) { |
| 73 if (e.code == 3) | 83 if (e.code == 3) |
| 74 log("PASS: Exception raised successfully. Type: " + e); | 84 log("PASS: Exception raised successfully. Type: " + e); |
| 75 else | 85 else |
| 76 log("FAIL: wrong exception type thrown. " + e.code + " w
as thrown, should of been Error: HierarchyRequestError: DOM Exception 3!"); | 86 log("FAIL: wrong exception type thrown. " + e.code + " w
as thrown, should of been Error: HierarchyRequestError: DOM Exception 3!"); |
| 77 } | 87 } |
| 78 try { | 88 try { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 142 } |
| 133 </script> | 143 </script> |
| 134 </head> | 144 </head> |
| 135 <body onload="test();"> | 145 <body onload="test();"> |
| 136 <p>This tests the insertRule(rule, index) and deleteRule(index) methods
of the CSSMediaRule interface. It has passed if | 146 <p>This tests the insertRule(rule, index) and deleteRule(index) methods
of the CSSMediaRule interface. It has passed if |
| 137 all of the output below begins with the text "PASS". | 147 all of the output below begins with the text "PASS". |
| 138 <ol id="console"> | 148 <ol id="console"> |
| 139 </ol> | 149 </ol> |
| 140 </body> | 150 </body> |
| 141 </html> | 151 </html> |
| OLD | NEW |