tor-browser

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

margin-001.html (3391B)


      1 <!DOCTYPE html>
      2 <link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
      3 <link rel="help" href="https://drafts.csswg.org/cssom/#the-csspagerule-interface">
      4 <title>CSSPageRule CSSOM test for nested cssRules (CSSMarginRule)</title>
      5 <style id="sheet">
      6  @page {}
      7  @page {
      8    @top-center {}
      9  }
     10  @page {
     11    color: red;
     12 
     13    /* This property doesn't apply, but the declaration should still be
     14       included: */
     15    column-count: 7;
     16 
     17    @bottom-left {
     18      margin: inherit;
     19    }
     20    @top-right {
     21      content: "hot";
     22      font-size: 2em;
     23    }
     24    @top-left-corner {}
     25    @top-left {}
     26    @top-center {}
     27    @top-right {}
     28    @top-right-corner {}
     29 
     30    color: inherit;
     31 
     32    @right-top {}
     33    @right-middle {}
     34    @right-bottom {}
     35    @bottom-right-corner {}
     36    @bottom-right {}
     37    @bottom-center {}
     38    @bottom-left {}
     39    @bottom-left-corner {}
     40    @left-bottom {}
     41    @left-middle {}
     42    @left-top {}
     43    @herring {}
     44 
     45    margin-left: 111px;
     46  }
     47 </style>
     48 <script src="/resources/testharness.js"></script>
     49 <script src="/resources/testharnessreport.js"></script>
     50 <script>
     51  var sheet = document.getElementById("sheet").sheet;
     52  test(() => {
     53    assert_not_equals(sheet, null);
     54    assert_equals(sheet.rules.length, 3);
     55  }, "There should be 3 @page rules.");
     56 
     57  test(() => {
     58    assert_equals(sheet.rules[0].cssRules.length, 0);
     59  }, "Rule #0");
     60 
     61  test(() => {
     62    assert_equals(sheet.rules[1].cssRules.length, 1);
     63    assert_equals(sheet.rules[1].cssRules[0].style.length, 0);
     64  }, "Rule #1");
     65 
     66  test(() => {
     67    var pageRule = sheet.rules[2];
     68    var style = pageRule.style;
     69    assert_equals(style.length, 3);
     70    assert_equals(style.marginLeft, "111px");
     71 
     72    assert_equals(pageRule.cssRules.length, 18);
     73 
     74    var bottomLeft = pageRule.cssRules[0];
     75    assert_equals(bottomLeft.name, "bottom-left");
     76    assert_equals(bottomLeft.style.length, 4);
     77    assert_equals(bottomLeft.style.marginTop, "inherit");
     78    assert_equals(bottomLeft.style.marginRight, "inherit");
     79    assert_equals(bottomLeft.style.marginBottom, "inherit");
     80    assert_equals(bottomLeft.style.marginLeft, "inherit");
     81 
     82    var topRight = pageRule.cssRules[1];
     83    assert_equals(topRight.name, "top-right");
     84    assert_equals(topRight.style.length, 2);
     85    assert_equals(topRight.style.content, "\"hot\"");
     86    assert_equals(topRight.style.fontSize, "2em");
     87 
     88    assert_equals(pageRule.cssRules[2].name, "top-left-corner");
     89    assert_equals(pageRule.cssRules[3].name, "top-left");
     90    assert_equals(pageRule.cssRules[4].name, "top-center");
     91    assert_equals(pageRule.cssRules[5].name, "top-right");
     92    assert_equals(pageRule.cssRules[6].name, "top-right-corner");
     93    assert_equals(pageRule.cssRules[7].name, "right-top");
     94    assert_equals(pageRule.cssRules[8].name, "right-middle");
     95    assert_equals(pageRule.cssRules[9].name, "right-bottom");
     96    assert_equals(pageRule.cssRules[10].name, "bottom-right-corner");
     97    assert_equals(pageRule.cssRules[11].name, "bottom-right");
     98    assert_equals(pageRule.cssRules[12].name, "bottom-center");
     99    assert_equals(pageRule.cssRules[13].name, "bottom-left");
    100    assert_equals(pageRule.cssRules[14].name, "bottom-left-corner");
    101    assert_equals(pageRule.cssRules[15].name, "left-bottom");
    102    assert_equals(pageRule.cssRules[16].name, "left-middle");
    103    assert_equals(pageRule.cssRules[17].name, "left-top");
    104  }, "Rule #2");
    105 </script>