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

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

I'd say there are two reasons for this behaviour:

1) IE does it this way.

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.

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

This is of course only a problem if the elements have border>0
and is a problem that would have appeared for IE users a long
time ago if pages depended on it. And as Garrett showed there
are scripts that correctly add border and scroll.

Best regards
Mike Wilson

Received on Friday, 25 April 2008 14:59:14 UTC