test_bug384419.html 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=384419
  5. -->
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  8. <title>Test for bug 384419</title>
  9. <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  10. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  11. <style type="text/css">
  12. html,body {
  13. color:black; background-color:white; font-size:16px; padding:0; margin:0;
  14. }
  15. body { margin: 10px; }
  16. table { border:15px solid black; margin-left:100px; }
  17. </style>
  18. <script type="text/javascript">
  19. function t3(id,expected,pid) {
  20. var el = document.getElementById(id);
  21. var actual = el.offsetLeft;
  22. is(actual, expected, id+".offsetLeft");
  23. var p = document.getElementById(id).offsetParent;
  24. is(p.id, pid, id+".offsetParent");
  25. }
  26. function run_test() {
  27. t3('rel384419',135,'body');
  28. t3('abs384419',135,'body');
  29. t3('fix384419',135,'body');
  30. }
  31. </script>
  32. </head>
  33. <body id="body">
  34. <!-- It's important for the test that the tables below are directly inside body -->
  35. <table cellpadding="7" cellspacing="3"><tr><td width="100"><div id="rel384419" style="position:relative;border:1px solid blue">X</div> relative</table>
  36. <table cellpadding="7" cellspacing="3"><tr><td width="100"><div id="abs384419" style="position:absolute;border:1px solid blue">X</div> absolute</table>
  37. <table cellpadding="7" cellspacing="3"><tr><td width="100"><div id="fix384419" style="position:fixed;border:1px solid blue">X</div> fixed</table>
  38. <pre id="test">
  39. <script class="testbody" type="text/javascript">
  40. run_test();
  41. </script>
  42. </pre>
  43. <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=384419">bug 384419</a>
  44. </body>
  45. </html>