tor-browser

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

CSSRuleList.html (1159B)


      1 <!doctype html>
      2 <html>
      3 <head>
      4    <meta charset="utf-8">
      5    <title>CSSOM - CSSRuleList interface</title>
      6    <link rel="help" href="https://drafts.csswg.org/cssom/#the-cssrulelist-interface">
      7    <script src="/resources/testharness.js"></script>
      8    <script src="/resources/testharnessreport.js"></script>
      9    <style>
     10        body { width: 50%; }
     11        #foo { height: 100px; }
     12    </style>
     13 
     14    <script>
     15    test(function () {
     16        var ruleList = document.styleSheets[0].cssRules;
     17        assert_equals(ruleList.length, 2, "CSSRuleList length attribute");
     18        assert_equals(ruleList[0].cssText, "body { width: 50%; }", "CSSRuleList indexed getter");
     19        assert_equals(ruleList[1].cssText, "#foo { height: 100px; }", "CSSRuleList indexed getter");
     20        assert_equals(ruleList[2], undefined, "CSSRuleList indexed getter");
     21        assert_equals(ruleList.item(0).cssText, "body { width: 50%; }", "CSSRuleList item function");
     22        assert_equals(ruleList.item(1).cssText, "#foo { height: 100px; }", "CSSRuleList item function");
     23        assert_equals(ruleList.item(2), null, "CSSRuleList item function");
     24    });
     25    </script>
     26 </head>
     27 </html>