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

On Fri, Apr 25, 2008 at 10:52 AM, Garrett Smith <dhtmlkitchen@gmail.com> wrote:
>
> On Fri, Apr 25, 2008 at 9:05 AM, Sylvain Galineau
>  <sylvaing@microsoft.com> wrote:
>  >

[snip]

>  <!doctype html>
>  <style>
>   body { margin:0 }
>   div { border:10px solid  }
>   div#x { border:20px solid orange; zoom:1 }
>
> </style>
>  <div><div id=x></div></div>
>
>  javascript:alert(x.offsetTop + ", " + x.currentStyle.hasLayout)
>
>  IE7 => 10, true
>
>  Shows that the offsetTop includes the parentNode's border-width and
>  also has a layout.
>
(Because the offsetParent is not the parentNode; instead, the
offsetParent is BODY).

hasLayout is irrelevant.

>
>  <!doctype html>
>  <style>
>   body { margin:0 }
>   div { border:10px solid; display: }
>   div#x { border:20px solid orange;  inline-block;  }
>
> </style>
>  <div><div id=x></div></div>
>
>
>  Changing offset* to be useful sounds like a good idea, but since
>  offset* is complicated by surprises in IE's implementation and bugs in
>  other implementations, it would not be possible to do it without
>  breaking sites and adding more confusion to the mess.
>
>  Garrett
>
>
>  >  Sylvain

Received on Friday, 25 April 2008 20:30:58 UTC