tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

insertRule-import-no-index.html (1497B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4    <title>CSS Test: CSSOM StyleSheet insertRule with import 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        @import url("support/a-green.css");
     13    </style>
     14 </head>
     15 <body>
     16 <div id="log"></div>
     17 <script type="text/javascript">
     18    var sheet = document.getElementById("styleElement").sheet;
     19    test(function() {
     20        assert_equals(sheet.cssRules.length, 1);
     21        assert_throws_dom("HierarchyRequestError", function() { sheet.insertRule("p { color: green; }"); });
     22        assert_equals(sheet.cssRules.length, 1);
     23    }, "insertRule with import and omitted index argument");
     24 
     25    test(function() {
     26        assert_equals(sheet.cssRules.length, 1);
     27        assert_throws_dom("HierarchyRequestError", function() { sheet.insertRule("p { color: yellow; }", undefined); });
     28        assert_equals(sheet.cssRules.length, 1);
     29        assert_equals(sheet.cssRules.item(0).cssText, "@import url(\"support/a-green.css\");");
     30    }, "insertRule with import and undefined index argument");
     31 </script>
     32 </body>
     33 </html>