tor-browser

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

margin-002.html (1353B)


      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>Add / remove declarations inside CSSMarginRule</title>
      5 <style id="sheet">
      6  @page {
      7    @top-center {}
      8  }
      9 </style>
     10 <script src="/resources/testharness.js"></script>
     11 <script src="/resources/testharnessreport.js"></script>
     12 <script>
     13  var sheet = document.getElementById("sheet").sheet;
     14  var marginRule = sheet.rules[0].cssRules[0];
     15  var style = marginRule.style;
     16 
     17  test(() => {
     18    assert_equals(style.length, 0);
     19    style.setProperty("widows", "7");
     20    assert_equals(style.length, 1);
     21    assert_equals(style.widows, "7");
     22    style.setProperty("margin-left", "50%");
     23    assert_equals(style.length, 2);
     24    assert_equals(style.marginLeft, "50%");
     25    style.setProperty("margin-left", "100px");
     26    assert_equals(style.length, 2);
     27    assert_equals(style.marginLeft, "100px");
     28    style.setProperty("margin", "auto");
     29    assert_equals(style.length, 5);
     30    assert_equals(style.marginLeft, "auto");
     31  }, "Add declarations");
     32 
     33  test(() => {
     34    assert_equals(style.length, 5);
     35    style.removeProperty("widows");
     36    assert_equals(style.length, 4);
     37    style.removeProperty("margin");
     38    assert_equals(style.length, 0);
     39  }, "Remove declarations");
     40 </script>