W3C home > Mailing lists > Public > www-style@w3.org > April 2008

RE: [cssom-view] padding edge / border edge for offsetTop/offsetLeft?

From: Sylvain Galineau <sylvaing@microsoft.com>
Date: Thu, 24 Apr 2008 15:22:16 -0700
To: Anne van Kesteren <annevk@opera.com>, 'Www-style' <www-style@w3.org>
Message-ID: <BE26041DBCC7014FA41031200B9AD9C7529A2BEC9C@NA-EXMSG-C104.redmond.corp.microsoft.com>
This may be a very basic question so I hope you bear with me. There is something I do not grok about measuring offsetLeft from the parent's left padding edge to the element's own left border edge, as defined in CSSOM-View: adding up offsetLeft values defined this way up the offsetParent chain will 'miss' the border for each element along the chain, resulting in an incomplete aggregate offset. As others have noted, simply adding offsets in this manner does not 'work' today but if this is how we define offsetLeft and offsetTop then clearly it cannot.

The same comment applies to offsetTop, of course.

Moreover, and rather confusingly imo, offsetWidth and offsetHeigh include the border. Lastly, IE legacy behavior seems to measure offsetLeft/Top from border edge to border edge in most cases I have tried. Opera 9.5b1 seems to be in agreement; Safari 3.1 and FF3 seem to comply with the current definition.

Overall, I do not yet understand the trade-offs involved in this set of definitions.



Received on Thursday, 24 April 2008 22:30:34 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:05 GMT