tor-browser

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

iframe-body-margin-attributes.html (1218B)


      1 <!doctype html>
      2 <title>iframe and body margin attributes</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <body marginwidth=20 marginheight=20 topmargin=10 rightmargin=10 bottommargin=10 leftmargin=10>
      6 <iframe data-desc="iframe marginwidth vs child body leftmargin" src="support/body-topmargin-leftmargin.html" marginwidth=10 marginheight=10></iframe>
      7 <iframe data-desc="iframe marginwidth vs child body marginwidth" src="support/body-marginwidth-marginheight.html" marginwidth=10 marginheight=10></iframe>
      8 <script>
      9 setup({explicit_done: true});
     10 
     11 onload = () => {
     12  test(() => {
     13    const style = getComputedStyle(document.body);
     14    assert_style_props(style);
     15  }, 'body marginwidth vs body leftmargin');
     16 
     17  [].forEach.call(document.querySelectorAll('iframe'), iframe => {
     18    test(() => {
     19      const win = iframe.contentWindow;
     20      const style = win.getComputedStyle(win.document.body);
     21      assert_style_props(style);
     22    }, iframe.dataset.desc);
     23  });
     24  done();
     25 }
     26 
     27 function assert_style_props(style) {
     28  for (let prop of ['marginTop', 'marginRight', 'marginBottom', 'marginLeft']) {
     29    assert_equals(style[prop], '20px', prop);
     30  }
     31 }
     32 </script>