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

> 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 UTC