<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
#wrap { | |
position: absolute; | |
width: 800px; | |
height: 200px; | |
border: 2px solid black; | |
left:0; | |
top:0; | |
} | |
#outer { | |
position: absolute; | |
display: inline-block; | |
width:200px; | |
height:200px; | |
background-color:grey; | |
} | |
#outer2 { | |
display: inline-block; | |
width:200px; | |
height:200px; | |
background-color:blue; | |
} | |
#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='outer2'></div> | |
<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 == 2) { | |
output.innerHTML = "Success" | |
} | |
} | |
var outer = document.getElementById("outer2"); | |
document.getElementById("wrap").removeChild(outer); | |
measure(); | |
</script> | |
</body> | |
</html> |