insertRule-namespace-no-index.html (1765B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSS Test: CSSOM StyleSheet insertRule with namespace and omitted second argument</title> 5 <link rel="author" title="Sendil Kumar N" href="mailto:sendilkumarn.opensource@gmail.com"> 6 <link rel="help" href="https://drafts.csswg.org/cssom/"> 7 <link rel="help" href="http://www.w3.org/TR/cssom-1/#the-cssrule-interface"> 8 <meta name="flags" content="dom"> 9 <script src="/resources/testharness.js" type="text/javascript"></script> 10 <script src="/resources/testharnessreport.js" type="text/javascript"></script> 11 <style id="styleElement"> 12 @namespace svg url(http://servo); 13 @namespace url(http://servo1); 14 @namespace svg url("http://servo2"); 15 </style> 16 </head> 17 <body> 18 <div id="log"></div> 19 <script type="text/javascript"> 20 var sheet = document.getElementById("styleElement").sheet; 21 test(function() { 22 assert_equals(sheet.cssRules.length, 3); 23 assert_throws_dom("HierarchyRequestError", function() { sheet.insertRule("p { color: green; }"); }); 24 assert_equals(sheet.cssRules.length, 3); 25 }, "insertRule with namespace and omitted index argument"); 26 27 test(function() { 28 assert_equals(sheet.cssRules.length, 3); 29 assert_throws_dom("HierarchyRequestError", function() { sheet.insertRule("p { color: yellow; }", undefined); }); 30 assert_equals(sheet.cssRules.length, 3); 31 }, "insertRule with namespace and undefined index argument"); 32 33 test(function() { 34 assert_equals(sheet.cssRules.length, 3); 35 sheet.insertRule("@import url(\"support/a-green.css\");"); 36 assert_equals(sheet.cssRules.length, 4); 37 }, "insertRule with namespace and omitted index argument should insert import"); 38 </script> 39 </body> 40 </html>