The default bug view has changed. See this FAQ.

If table element has margin styled, then the offsetLeft, offsetTop, offsetWidth and offsetHeight of this table element will be wrong.

NEW
Unassigned

Status

()

Core
Layout
11 years ago
6 years ago

People

(Reporter: Topper, Unassigned)

Tracking

({testcase})

Trunk
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(2 attachments)

(Reporter)

Description

11 years ago
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.
(Reporter)

Comment 1

11 years ago
Created attachment 242275 [details]
show bugs
Component: General → Layout
Product: Firefox → Core
QA Contact: general → layout
Version: unspecified → 1.8 Branch

Comment 2

10 years ago
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

10 years ago
If bug 258255 was in the correct component then this would be a duplicate.

Comment 4

10 years ago
This bug causes errors in Firebug inspect for tables with margin.
http://code.google.com/p/fbug/issues/detail?id=289

Comment 5

9 years ago
I want to mark this 'firebug wanted' but the UI won't let me. So I am cc beltzner.

Comment 6

9 years ago
Just tested this in FF3.0b4pre and the problem still exists but the offset is different.
Status: UNCONFIRMED → NEW
Ever confirmed: true
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.
Whiteboard: [firebug-p1]
Version: 1.8 Branch → Trunk
Whiteboard: [firebug-p1] → [firebug-p3]

Comment 8

8 years ago
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.
Whiteboard: [firebug-p3] → [firebug-p2]

Comment 9

8 years ago
I'll try marking the firebug-p2 bugs as wanted for 1.9.2
Flags: wanted1.9.2?
Also happens on OS X. A good testcase can be found with attachment 337022 [details].
Keywords: testcase
OS: Windows XP → All
Hardware: PC → All
John, please use getBoundingClientRect/getClientRects in Firebug instead of the offset* properties.

Comment 12

8 years ago
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.
https://developer.mozilla.org/En/DOM:element.getBoundingClientRect
http://ejohn.org/blog/getboundingclientrect-is-awesome/

Comment 14

8 years ago
Mike Radcliffe took up the challenge and used getBoundingClientRect to slay at least 6 Firebug bugs related to offsets.  (In Firebug 1.4a24).
Flags: wanted1.9.2?
Whiteboard: [firebug-p2]
I guess bug 562005 is related to this bug, right?
You need to log in before you can comment on or make changes to this bug.