tor-browser

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

blocks-ignore-line-height.html (3321B)


      1 <!doctype html>
      2 <html>
      3 <head>
      4  <title>The blocks ignore line-height quirk</title>
      5  <script src="/resources/testharness.js"></script>
      6  <script src="/resources/testharnessreport.js"></script>
      7  <style> iframe { width:200px; height:20px; } </style>
      8 </head>
      9 <body>
     10  <div id=log></div>
     11  <iframe id=quirks></iframe>
     12  <iframe id=almost></iframe>
     13  <iframe id=standards></iframe>
     14  <script>
     15    setup({explicit_done:true});
     16    onload = function() {
     17        var html = "<style id=style></style>";
     18        var a_doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
     19        var s_doctype = '<!DOCTYPE HTML>';
     20        var q = document.getElementById('quirks').contentWindow;
     21        var a = document.getElementById('almost').contentWindow;
     22        var s = document.getElementById('standards').contentWindow;
     23        q.document.open();
     24        q.document.write(html);
     25        q.document.close();
     26        a.document.open();
     27        a.document.write(a_doctype + html);
     28        a.document.close();
     29        s.document.open();
     30        s.document.write(s_doctype + html);
     31        s.document.close();
     32        [q, a, s].forEach(function(win) {
     33            ['style', 'test', 'ref', 's_ref'].forEach(function(id) {
     34                Object.getPrototypeOf(win).__defineGetter__(id, function() { return win.document.getElementById(id); });
     35            });
     36        });
     37 
     38        var tests = [
     39        {style:'#ref { display:block }', body:
     40        '<div id=test><font size=1>x</font></div>'+
     41        '<font id=ref size=1>x</font>'+
     42        '<div id=s_ref>x</div>'},
     43 
     44        {style:'#ref { display:block }', body:
     45        '<div id=test><font size=1>x</font><br><font size=1>x</font></div>'+
     46        '<font id=ref size=1>x<br>x</font>'+
     47        '<div id=s_ref>x<br>x</div>'},
     48 
     49        {style:'#ref { display:block }', body:
     50        '<div id=test><font size=1>foo</font><br><font size=1>foo</font><div>x</div></div>'+
     51        '<font id=ref size=1>foo<br>foo<br><font size=3>x</font></font>'+
     52        '<div id=s_ref>x<br>x<br>x</div>'},
     53 
     54        {style:'#ref { display:block } div, #ref { line-height:2 } span { font-size:50% }', body:
     55        '<div id=test><span>x</span></div>'+
     56        '<span id=ref>x</span>'+
     57        '<div id=s_ref>x</div>'},
     58        ];
     59 
     60        tests.forEach(function(t) {
     61            test(function() {
     62                q.style.textContent = t.style;
     63                a.style.textContent = t.style;
     64                s.style.textContent = t.style;
     65                q.document.body.innerHTML = t.body;
     66                a.document.body.innerHTML = t.body;
     67                s.document.body.innerHTML = t.body;
     68 
     69                assert_equals(q.getComputedStyle(q.test).height,
     70                              q.getComputedStyle(q.ref).height,
     71                              'quirks mode');
     72                assert_equals(a.getComputedStyle(a.test).height,
     73                              a.getComputedStyle(a.ref).height,
     74                              'almost standards mode');
     75                assert_equals(s.getComputedStyle(s.test).height,
     76                              s.getComputedStyle(s.s_ref).height,
     77                              'standards mode');
     78            }, document.title+', '+t.style+t.body);
     79        });
     80 
     81        done();
     82    }
     83  </script>
     84 </body>
     85 </html>