c2d54c91a23f0fa8c45760a41b9574335ee1f1f4.svn-base 990 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Range tests</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6. <style>
  7. #tests {
  8. font-family:Arial;
  9. }
  10. </style>
  11. </head>
  12. <body>
  13. <div id="tests"></div>
  14. <script>
  15. var div = document.getElementById("tests"), item, range, textNode, bounds;
  16. for (var i = 6; i < 72; i++) {
  17. item = document.createElement("div");
  18. item.style.fontSize = i + "px";
  19. item.style.lineHeight = (10 + i * 2) + "px";
  20. textNode = document.createTextNode(i);
  21. item.appendChild(textNode);
  22. div.appendChild(item);
  23. range = document.createRange();
  24. range.setStart(textNode, 0);
  25. range.setEnd(textNode, i.toString().length);
  26. bounds = range.getBoundingClientRect();
  27. textNode.nodeValue += " " + bounds.height + " " + bounds.bottom + (i % 3 === 0);
  28. }
  29. </script>
  30. <script src="test.js"></script>
  31. </body>
  32. </html>