6 testRunner
.dumpAsText();
9 var li
= document
.createElement("li");
10 li
.appendChild(document
.createTextNode(str
));
11 var console
= document
.getElementById("console");
12 console
.appendChild(li
);
15 function findPosX(obj
) {
18 ret
+= obj
.offsetLeft
;
19 obj
= obj
.offsetParent
;
24 // This code was reduced from the menu system on doula.co.il which is why we call offsetParent.offsetLeft rather than
25 // just retreiving the element directly.
26 function printDivPlacement() {
27 var the_node
= document
.getElementById('menu_node');
28 log("node.offsetParent.offsetLeft=" + the_node
.offsetParent
.offsetLeft
+ " (Should be 302 as in FF and IE)");
29 log("findPosX=" + findPosX(the_node
.offsetParent
) + " (Should be 302 as in FF and IE)");
33 <body onload=
"printDivPlacement()">
34 <div style=
"position:absolute; top:0px; left:0px; width:800px; background-color:#C3DCBF;">
35 <table width=
"200px" style=
"margin: auto;">
37 <td style=
"position:relative">
38 <div id=menu_node
>Menu Node
</div>
44 <h3>This test verifies that offsetLeft is calculated correctly for a relatively positioned td element.
</h3>