summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/block/positioning/offsetLeft-relative-iframe.html
blob: de69742dbe216ff3402321a4f38bb0160823eedf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!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>