at-namespace.html (1070B)
1 <!doctype html> 2 <title>CSS Test: @namespace in CSSOM is not severely broken</title> 3 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 4 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1464865"> 5 <link rel="help" href="https://drafts.csswg.org/cssom/#insert-a-css-rule"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <style id="s"> 9 div { color: green } 10 </style> 11 <div>Should be green</div> 12 <script> 13 test(function() { 14 assert_throws_dom("InvalidStateError", function() { 15 s.sheet.insertRule('@namespace myhtml url("http://www.w3.org/1999/xhtml")', 0); 16 }); 17 assert_equals(s.sheet.cssRules.length, 1, "Shouldn't have been inserted"); 18 assert_throws_dom("SyntaxError", function() { 19 s.sheet.insertRule("myhtml|div { color: red !important }", 0); 20 }); 21 assert_equals(s.sheet.cssRules.length, 1); 22 assert_equals( 23 getComputedStyle(document.querySelector("div")).color, 24 "rgb(0, 128, 0)", 25 "Namespace shouldn't be registered" 26 ); 27 }); 28 </script>