elem.offsetParent in js
<p>I'm looking at this piece of javasript from Pro JS techniques book. </p>

<p>He's trying to find the offsetLeft of an element. But in firefox, isn't the offsetParent always the root element body? </p>

<p>I'm not sure how it would recurse up. </p>

<pre><code>// Find the X (Horizontal, Left) position of an element
function pageX(elem) {
// See if we' re at the root element, or not
return elem. offsetParent ?
// If we can still go up, add the current offset and recurse upwards
elem. offsetLeft + pageX( elem. offsetParent ) :
// Otherwise, just get the current offset
elem. offsetLeft;
}
</code></pre>
