Last Comment Bug 356665 - If table element has margin styled, then the offsetLeft, offsetTop, offsetWidth and offsetHeight of this table element will be wrong.
: If table element has margin styled, then the offsetLeft, offsetTop, offsetWid...
Status: NEW
: testcase
Product: Core
Classification: Components
Component: Layout (show other bugs)
: Trunk
: All All
: -- normal with 3 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
https://bugzilla.mozilla.org/attachme...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-10-14 08:41 PDT by Topper
Modified: 2011-04-01 17:12 PDT (History)
9 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
show bugs (5.54 KB, text/html)
2006-10-14 08:44 PDT, Topper
no flags Details
Shows erroneous values for table offset widths when the margin is set. (3.44 KB, text/html)
2007-02-23 10:43 PST, Dave
no flags Details

Description Topper 2006-10-14 08:41:48 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7

If table element has margin styled, then we got
offsetWidth = correct value + margin-left + margin-right,
offsetHeight = correct value + margin-top + margin-bottom,
offsetLeft = correct value + margin-left,
offsetTop = correct value + margin-top.
The BoxObject of this table has same problems.


Reproducible: Always

Steps to Reproduce:
1. Create a TABLE element, with margin styled.
2. Check offsetLeft, offsetWidth, ...
3.

Actual Results:  
offsetWidth = correct value + margin-left + margin-right,
offsetHeight = correct value + margin-top + margin-bottom,
offsetLeft = correct value + margin-left,
offsetTop = correct value + margin-top.
Comment 1 Topper 2006-10-14 08:44:03 PDT
Created attachment 242275 [details]
show bugs
Comment 2 Dave 2007-02-23 10:43:53 PST
Created attachment 256192 [details]
Shows erroneous values for table offset widths when the margin is set.

Alignment was effected through the following css style:
table.alignCenter
{
margin-left:auto;
margin-right:auto;
}
This method was chosen to pass W3C validation.  However the bug is there as well when you use the align=center attribute for the table
Comment 3 John P Baker 2007-02-26 03:36:05 PST
If bug 258255 was in the correct component then this would be a duplicate.
Comment 4 John J. Barton 2007-09-23 15:52:17 PDT
This bug causes errors in Firebug inspect for tables with margin.
http://code.google.com/p/fbug/issues/detail?id=289
Comment 5 John J. Barton 2008-01-04 10:39:42 PST
I want to mark this 'firebug wanted' but the UI won't let me. So I am cc beltzner.
Comment 6 John J. Barton 2008-02-27 09:41:51 PST
Just tested this in FF3.0b4pre and the problem still exists but the offset is different.
Comment 7 Justin Dolske [:Dolske] 2008-02-28 19:04:44 PST
Could we get a testcase that reports a binary pass/fail result [instead of just a gob of numbers] for the dimensions being tested? That would help for verifying the bug, and eventual conversion to a mochitest for the test suite.
Comment 8 John J. Barton 2008-11-23 20:05:45 PST
Also probably causes:
 Issue 68:  	 Inspect outline located too much to the left or right of element
http://code.google.com/p/fbug/issues/detail?id=68
 Issue 123:  	 "position: absolute" on "body" element confuses Firebug
http://code.google.com/p/fbug/issues/detail?id=123
Moving up on firebug list.
Comment 9 John J. Barton 2008-12-14 09:43:24 PST
I'll try marking the firebug-p2 bugs as wanted for 1.9.2
Comment 10 Henrik Skupin (:whimboo) 2008-12-14 11:59:07 PST
Also happens on OS X. A good testcase can be found with attachment 337022 [details].
Comment 11 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2009-02-03 11:03:27 PST
John, please use getBoundingClientRect/getClientRects in Firebug instead of the offset* properties.
Comment 12 John J. Barton 2009-02-03 11:24:18 PST
Ok thanks, I thought that these functions might be good alternatives but I didn't understand the details enough to know for sure. This will encourage me.
Comment 13 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2009-02-03 11:30:37 PST
https://developer.mozilla.org/En/DOM:element.getBoundingClientRect
http://ejohn.org/blog/getboundingclientrect-is-awesome/
Comment 14 John J. Barton 2009-05-04 20:58:36 PDT
Mike Radcliffe took up the challenge and used getBoundingClientRect to slay at least 6 Firebug bugs related to offsets.  (In Firebug 1.4a24).
Comment 15 Martijn Wargers [:mwargers] (gone per 2016-05-31 :-( ) 2010-04-27 05:37:15 PDT
I guess bug 562005 is related to this bug, right?

Note You need to log in before you can comment on or make changes to this bug.