| <!DOCTYPE html> |
| <html> |
| <head> |
| <style> |
| #wrap { |
| position: absolute; |
| width: 400px; |
| height: 200px; |
| border: 2px solid black; |
| left:0; |
| top:0; |
| } |
| |
| #outer { |
| position: absolute; |
| width:200px; |
| height:200px; |
| background-color:grey; left:0; top:0; |
| } |
| |
| #inner { |
| width: 100px; |
| height: 100px; |
| background-color:green; |
| position: fixed; top:2px; |
| } |
| |
| #outer p { |
| margin-left: 110px; |
| } |
| </style> |
| </head> |
| <body> |
| <div id='wrap'> |
| <div id='outer'> |
| <div id='inner'></div> |
| <p>Foo</p> |
| </div> |
| </div> |
| <div id="output">Failure</div> |
| <script> |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| } |
| |
| function measure() { |
| var output = document.getElementById("output"); |
| if (document.getElementById('inner').offsetLeft >= 200) { |
| output.innerHTML = "Success" |
| } |
| } |
| |
| document.getElementById('outer').style.left = '200px'; |
| measure(); |
| </script> |
| </body> |
| </html> |