tor-browser

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

insertRule-charset-no-index.html (1449B)


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