test_bug384419.html (1822B)
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 10 <script src="/tests/SimpleTest/SimpleTest.js"></script> 11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 12 13 <style type="text/css"> 14 html,body { 15 color:black; background-color:white; font-size:16px; padding:0; margin:0; 16 } 17 body { margin: 10px; } 18 table { border:15px solid black; margin-left:100px; } 19 </style> 20 21 22 <script type="text/javascript"> 23 function t3(id,expected,pid) { 24 var el = document.getElementById(id); 25 var actual = el.offsetLeft; 26 is(actual, expected, id+".offsetLeft"); 27 28 var p = document.getElementById(id).offsetParent; 29 if (pid == null) { 30 is(p, null, id + ".offsetParent"); 31 } else { 32 is(p.id, pid, id + ".offsetParent"); 33 } 34 } 35 36 function run_test() { 37 t3('rel384419',135,'body'); 38 t3('abs384419',135,'body'); 39 t3('fix384419',135,null); 40 } 41 </script> 42 43 </head> 44 <body id="body"> 45 <!-- It's important for the test that the tables below are directly inside body --> 46 <table cellpadding="7" cellspacing="3"><tr><td width="100"><div id="rel384419" style="position:relative;border:1px solid blue">X</div> relative</table> 47 <table cellpadding="7" cellspacing="3"><tr><td width="100"><div id="abs384419" style="position:absolute;border:1px solid blue">X</div> absolute</table> 48 <table cellpadding="7" cellspacing="3"><tr><td width="100"><div id="fix384419" style="position:fixed;border:1px solid blue">X</div> fixed</table> 49 50 51 <pre id="test"> 52 <script class="testbody" type="text/javascript"> 53 run_test(); 54 </script> 55 </pre> 56 57 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=384419">bug 384419</a> 58 59 </body> 60 </html>