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: Fri, 25 Apr 2008 09:05:08 -0700
To: Mike Wilson <mikewse@hotmail.com>
CC: 'Www-style' <www-style@w3.org>
Message-ID: <BE26041DBCC7014FA41031200B9AD9C7529A2BEECF@NA-EXMSG-C104.redmond.corp.microsoft.com>

> 1) IE does it this way.
This is probably the main source of confusion on my side; my strict-mode tests with IE7/IE8 show parent outer-border-edge to element outer-border-edge; same with Opera. Safari and Firefox behave as currently specified in CSSOM-View.



> 2) It's compatible with CSS 2.1's positioning with left/top
>    attributes for position:absolute elements.
>    I e, if you have an absolutely positioned element that
>    you assign
>      left:10px
>    to, then offsetLeft will also return 10 as the offset is
>    measured from the same points (padding edge to border edge)
>    as used by CSS positioning. Of course assuming here that the
>    offsetParent and Containing Block elements are the same,
>    which they usually are in standards-mode IE, but not in the
>    current CSSOM proposal.
This is good background, thank you.

> This is of course only a problem if the elements have border>0
Correct.

> and is a problem that would have appeared for IE users a long
> time ago if pages depended on it.
Unless IE goes border-edge to border-edge in which case it worked whether borders were present or not.


> And as Garrett showed there
> are scripts that correctly add border and scroll.
Garret's script is all-around remarkable in both its thoroughness and size. That such effort is needed to compute offset should indicate we have a very broken API, imo. I may be wrong but aren't Garret's disagreements essentially a statement that we are about to entrench this, or worse ? Backward compatibility is a worthwhile goal, but if the end result requires this much effort to get the proper answer, maybe those who think we should move on and get the ClientRect APIs right have a point.

Sylvain
Received on Friday, 25 April 2008 16:07:18 GMT

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