Width from getComputedStyle does not match offsetWidth of various elements




10 years ago
8 years ago


(Reporter: pennig, Unassigned)


3.0 Branch
Mac OS X

Firefox Tracking Flags

(Not tracked)


(Whiteboard: [CLOSEME 2010-11-01])


(1 attachment)



10 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.20
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9) Gecko/2008061004 Firefox/3.0

Obtaining the width property using getComputedStyle returns a fractional px value  of various elements, which does not reflect the output of offsetWidth (an integer). This behavior differs from at least Firefox 2 on OS X, Firefox 2 & 3 on windows, and other browsers in the marketplace that support getComputedStyle.

Elements this behavior applies to are those that have no explicit width set and are set to display as inline-block or are floated.

Reproducible: Always

Steps to Reproduce:
1. Open HTML testcase in Firefox 3 for Mac
2. Observe whether the text wraps or not.
Actual Results:  
The text wraps because the Actual Width is larger than the offsetWidth.

Expected Results:  
The text should not wrap, because the Actual Width resolves to an integer equal to offsetWidth

HTML testcase attached.

Comment 1

10 years ago
Created attachment 325619 [details]
HTML Testcase


10 years ago
Version: unspecified → 3.0 Branch

Comment 2

10 years ago
Also, this issue currently manifests itself in the breadcrumb navigation of http://store.apple.com/

Comment 3

10 years ago
Is bug 430153 comment 6 relevant here?

Comment 4

10 years ago

I had considered that, but the fact that this subpixel distinction only seems to manifest itself on Firefox for Mac leads me to believe that this an issue that deserves some attention, if not a fix. Perhaps the Mac version could me made to mimic the Windows version, or vice versa.
This is a mass search for Firefox General bugs filed against version 3.0 that are UNCO and have not been changed for 200 days.

Reporter, please update to Firefox 3.6.10 or alter. Firefox 3.0 is no longer supported and is no longer receiving updates. After you update, please create a fresh profile, http://support.mozilla.com/kb/managing+profiles, and test to see if your bug still exists. If you still the bug, then please post a comment with the version you tested against, and the problem. If the issue is no longer there, please set the RESOLUTION to  RESOLVED, WORKSFORME.
Whiteboard: [CLOSEME 2010-11-01]
No reply from reporter, INCOMPLETE. Please retest with Firefox 3.6.12 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Last Resolved: 8 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.