blob: de69742dbe216ff3402321a4f38bb0160823eedf [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function log(str) {
var li = document.createElement("li");
li.appendChild(document.createTextNode(str));
var console = document.getElementById("console");
console.appendChild(li);
}
function findPosX(obj) {
var ret = 0;
do {
ret += obj.offsetLeft;
obj = obj.offsetParent;
} while (obj);
return ret;
}
function printDivPlacement() {
var the_node = document.getElementById('frame');
log("node.offsetLeft=" + the_node.offsetLeft + " (Should be 303 as in FF and IE)");
log("findPosX=" + findPosX(the_node) + " (Should be 303 as in FF and IE)");
}
</script>
</head>
<body onload="printDivPlacement()">
<div style="position:absolute; top:0px; left:0px; width:800px; background-color:#C3DCBF;">
<table width="200px" style="margin: auto;">
<tr>
<td>
<iframe id=frame style="position: relative; width:20px; height:20px"></iframe>
</td>
</tr>
</table>
</div>
<br><br>
<h3>This test verifies that offsetLeft is calculated correctly for a relatively positioned iframe element inside a table.</h3>
<ul id=console></ul>
</body>
</html>