- From: Mike Wilson <mikewse@hotmail.com>
- Date: Wed, 19 Mar 2008 12:07:33 +0100
- To: "'Garrett Smith'" <dhtmlkitchen@gmail.com>, "'Www-style'" <www-style@w3.org>
Hi Garrett, > Aside from the bugs that occur in all FF/Op/Saf, there is a 1 clear, > fundamental difference in the handling of offsetTop/Left when the > offsetParent in question is BODY with position: relative. <snip> > Insight: > For getting the position of an element: using offsetTop: > position: relative can be added to the container, BODY. This makes > body work like a "normal" offsetParent in all browsers except Opera. That's an interesting find! There are always more details to be uncovered... So, it looks like Opera is the only browser today that is fully compatible with CSOMM, others (representing ~99% of traffic) will have to change. > Position: relative on BODY is useful > It use useful because makes BODY a containing block for absolutely > positioned children; BODY margin affects absolutely positioned > children. I agree totally. > Sad path: > If the parentNode is BODY, then (even) if the parentNode has position: > relative and el has position, then the function will return the > distance between el and the edge of the document. > > This is how CSSOM defines it, and in reality, it is a problem > in Opera. > > How should other browsers adopt this without breaking pages? I agree with you, Garrett. In this case you want to deal with the BODY margin separately from the positioned element's relation to its offsetParent. It's two different decisions of the layout. It also fits well with the Containing Block analogy for offsetParent and offsetLeft/Top. Best regards Mike
Received on Wednesday, 19 March 2008 11:08:36 UTC