066-deep-nesting.html 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>066 deep nesting</title>
  6. <style>
  7. body { background: #ffffff; color: #202020; font-family: sans-serif;
  8. margin: 12px; font-size: 18px; }
  9. #n0 { background: #f4f4f4; padding: 2px; }
  10. #deep { background: #dddddd; margin: 6px 0; }
  11. #result { background: #ffc8c8; color: #000000; padding: 8px;
  12. margin-top: 12px; }
  13. </style>
  14. </head>
  15. <body>
  16. <h1>066 &mdash; deep nesting</h1>
  17. <p>News pages wrap a teaser in many layout containers. Text at a realistic
  18. nesting depth must still be laid out.</p>
  19. <div id="n0"><div id="n1"><div id="n2"><div id="n3">
  20. <div id="n4"><div id="n5"><div id="n6"><div id="n7">
  21. <div id="n8"><div id="n9"><div id="n10"><div id="n11">
  22. <div id="n12"><div id="n13"><div id="n14"><div id="n15">
  23. <h2 id="deep">Deep content headline</h2>
  24. <p>Deep content body text.</p>
  25. </div></div></div></div></div></div></div></div>
  26. </div></div></div></div></div></div></div></div>
  27. <div id="result">checking...</div>
  28. <script>
  29. setTimeout(function () {
  30. var d = document.getElementById('deep');
  31. var r = d.getBoundingClientRect();
  32. var style = getComputedStyle(d);
  33. var ok = r.height > 10 && r.width > 100 &&
  34. style.display === 'block';
  35. var out = document.getElementById('result');
  36. if (out) {
  37. out.style.background = ok ? '#c8f0c8' : '#ffc8c8';
  38. out.textContent = (ok ? 'DEEP-OK ' : 'DEEP-FAIL ') +
  39. Math.round(r.left) + ',' + Math.round(r.top) + ' ' +
  40. Math.round(r.width) + 'x' + Math.round(r.height) +
  41. ' display=' + style.display;
  42. }
  43. }, 300);
  44. </script>
  45. </body>
  46. </html>