tor-browser

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

table-cell-nowrap-minimum-width-calculation.html (2701B)


      1 <!doctype html>
      2 <html>
      3 <head>
      4  <title>The table cell nowrap minimum width calculation 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 
     17    var png = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==";
     18    var preload = new Image();
     19    preload.src = png;
     20 
     21    onload = function() {
     22        var html = "<style id=style></style>";
     23        var a_doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
     24        var s_doctype = '<!DOCTYPE HTML>';
     25        var q = document.getElementById('quirks').contentWindow;
     26        var a = document.getElementById('almost').contentWindow;
     27        var s = document.getElementById('standards').contentWindow;
     28        q.document.open();
     29        q.document.write(html);
     30        q.document.close();
     31        a.document.open();
     32        a.document.write(a_doctype + html);
     33        a.document.close();
     34        s.document.open();
     35        s.document.write(s_doctype + html);
     36        s.document.close();
     37        [q, a, s].forEach(function(win) {
     38            ['style', 'test', 'ref', 's_ref'].forEach(function(id) {
     39                Object.getPrototypeOf(win).__defineGetter__(id, function() { return win.document.getElementById(id); });
     40            });
     41        });
     42        q.title = 'quirks mode';
     43        a.title = 'almost standards mode';
     44        s.title = 'standards mode';
     45 
     46        var tests = [
     47        {desc:"basic",
     48        style:'table { width:8px } #test { width:10px }',
     49        body:'<table><tr><td id=test nowrap></table>'+
     50        '<table><tr><td id=ref><img src="{png}" width=10></table>'+
     51        '<table><tr><td id=s_ref></table>'},
     52        ];
     53 
     54        tests.forEach(function(t) {
     55            test(function() {
     56                var style = t.style.replace(/\{png\}/g, png);
     57                var body = t.body.replace(/\{png\}/g, png);
     58                [q, a, s].forEach(function(win) {
     59                    win.style.textContent = style;
     60                    win.document.body.innerHTML = body;
     61                    assert_equals(win.getComputedStyle(win.test).width,
     62                                  win.getComputedStyle(win == q ? win.ref : win.s_ref).width,
     63                                  win.title);
     64                });
     65            }, document.title+', '+t.desc);
     66        });
     67 
     68        done();
     69    }
     70  </script>
     71 </body>
     72 </html>