tor-browser

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

margin-rules-001.html (1508B)


      1 <!DOCTYPE html>
      2 <link rel="author" title="Mozilla" href="https://mozilla.org">
      3 <link rel="help" href="https://drafts.csswg.org/css-page-3/#margin-at-rules">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/css/support/parsing-testcommon.js"></script>
      7 <style>
      8 #test{ }
      9 </style>
     10 <script>
     11 'use strict';
     12 test(t => {
     13  const ruleTypes = [
     14    "@top-left-corner",
     15    "@top-left",
     16    "@top-center",
     17    "@top-right",
     18    "@top-right-corner",
     19    "@bottom-left-corner",
     20    "@bottom-left",
     21    "@bottom-center",
     22    "@bottom-right",
     23    "@bottom-right-corner",
     24    "@left-top",
     25    "@left-middle",
     26    "@left-bottom",
     27    "@right-top",
     28    "@right-middle",
     29    "@right-bottom"
     30  ];
     31  // Test that margin-rules are not valid at a top-level.
     32  for(let t in ruleTypes){
     33    test_invalid_rule(ruleTypes[t] + "{ }");
     34  }
     35  // Test that margin-rules are not valid in style rules.
     36  assert_equals(document.styleSheets.length, 1);
     37  let styleSheet = document.styleSheets[0];
     38  assert_equals(styleSheet.rules.length, 1);
     39  let rule = styleSheet.rules[0];
     40  for(let t in ruleTypes){
     41    assert_throws_dom(
     42        DOMException.SYNTAX_ERR,
     43        () => rule.insertRule(ruleTypes[t] + "{ }"),
     44        "Should not be able to add " + ruleTypes[t]  + " to a style rule");
     45  }
     46  // Test that margin-rules are valid inside page-rules.
     47  for(let t in ruleTypes){
     48    test_valid_rule("@page { " + ruleTypes[t] + " { } }");
     49  }
     50 }, "margin-rules-001");
     51 </script>