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

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

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Fri, 25 Apr 2008 13:30:20 -0700
Message-ID: <c9e12660804251330l652f5262v201304417a24a8ac@mail.gmail.com>
To: "Sylvain Galineau" <sylvaing@microsoft.com>
Cc: "Mike Wilson" <mikewse@hotmail.com>, Www-style <www-style@w3.org>

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 GMT

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