min-width-tables-001.html (2169B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Test: Table Layout and Viewport Resizing</title> 6 <link rel="author" title="Chris Rebert" href="http://chrisrebert.com"> 7 <link rel="help" href="https://drafts.csswg.org/css2/tables.html#auto-table-layout"> 8 <link rel="help" href="https://drafts.csswg.org/mediaqueries-3/#width"> 9 <link rel="help" href="https://drafts.csswg.org/mediaqueries-4/#width"> 10 <link rel="match" href="../reference/ref-filled-green-100px-square.xht"> 11 <meta name="flags" content="dom"> 12 <meta name="assert" content="Resizing a page which toggles the `display` of elements between `block` and `table-cell` based on the viewport width should not cause unnecessary wrapping of the table."> 13 <style> 14 iframe { 15 border: 0; 16 } 17 </style> 18 </head> 19 <body> 20 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 21 <iframe id="toy" width="100" height="300" src="support/min-width-tables-001-iframe.html"></iframe> 22 <!-- See min-width-tables-001-iframe.html for the derivation of the 100px value --> 23 <!-- We use 300px height so the incorrect stacking is visible in failure cases --> 24 <!-- This test is not about iframes specifically. It's just that resizing an iframe is more reliable than resizing the window, given browser security restrictions. --> 25 <script> 26 window.addEventListener('load', function () { 27 var PAINT_MS = 250;/* Assume the browser takes about this long to layout/paint this whole page */ 28 var iframe = document.getElementById('toy'); 29 window.setTimeout(function () { 30 iframe.width = 64;/* <100px ; toggle media query off */ 31 window.setTimeout(function () { 32 iframe.width = 100;/* >=100px ; toggle media query on; back to initial width */ 33 // Take the reftest screenshot after the last relayout/repaint finishes 34 window.setTimeout(function () { 35 document.documentElement.className = ''; 36 }, PAINT_MS); 37 }, PAINT_MS); 38 }, PAINT_MS); 39 }, false); 40 </script> 41 </body> 42 </html>