Bug 26020 - The offsetLeft of an element with non-absolute position whose offsetParent is the position:static body does not include the html element's left margin
Summary: The offsetLeft of an element with non-absolute position whose offsetParent is...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Minor
Assignee: Nobody
URL:
Keywords: GoogleBug
Depends on:
Blocks:
 
Reported: 2009-05-26 07:19 PDT by Aharon (Vladimir) Lanin
Modified: 2011-03-08 09:21 PST (History)
4 users (show)

See Also:


Attachments
test case (875 bytes, text/html)
2009-05-26 07:20 PDT, Aharon (Vladimir) Lanin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aharon (Vladimir) Lanin 2009-05-26 07:19:32 PDT
If you have:

<!DOCTYPE html>
<html>
  <head>
    <style type="text/css">
      html {margin-left: 10px}
      body {margin: 0px}
    </style>
  </head>
  <body>
    <div id="static">static</div>
    <div id="absolute" style="position:absolute">absolute</div>
  </body>
</html>

Then static.offsetLeft is 0. It should be 10, i.e. include the html margin, the same as absolute.offsetLeft. It already includes the html left border and padding and the body left margin and border and padding. This is the way it is in IE8, and it makes sense. In IE7, it only includes the body padding, which is a bug they fixed in IE8.
Comment 1 Aharon (Vladimir) Lanin 2009-05-26 07:20:43 PDT
Created attachment 30668 [details]
test case
Comment 2 Alexey Proskuryakov 2010-12-14 11:24:53 PST
See also: <http://www.w3.org/TR/cssom-view/#offset-attributes>
Comment 3 Jeremy Moskovich 2011-03-04 08:35:00 PST
Aharon: It appears that FF also behaves this way, up to and including FF4, have you filed a bug against them as well?
Comment 4 Jeremy Moskovich 2011-03-04 09:45:41 PST
Another bit of information: Operat matches IE8 here.
Comment 5 Aharon (Vladimir) Lanin 2011-03-08 09:13:26 PST
(In reply to comment #3)
> Aharon: It appears that FF also behaves this way, up to and including FF4, have you filed a bug against them as well?

As far as I can see from my notes at the time that I filed this bug, I tested it in FF (2 & 3), and found that it did *not* behave this way.
Comment 6 Aharon (Vladimir) Lanin 2011-03-08 09:21:57 PST
(In reply to comment #5)
> (In reply to comment #3)
> > Aharon: It appears that FF also behaves this way, up to and including FF4, have you filed a bug against them as well?
> 
> As far as I can see from my notes at the time that I filed this bug, I tested it in FF (2 & 3), and found that it did *not* behave this way.

To clarify, I see that FF 3.6.13 (which is what I currently have installed) behaves that way, but according to my notes the version of FF 3 I tested back then did not. Unfortunately, I did not note which version of FF 3 I had used.