scrollWidth wrong for <pre>-elements

RESOLVED INVALID

Status

()

Core
DOM
RESOLVED INVALID
12 years ago
5 years ago

People

(Reporter: Torben, Unassigned)

Tracking

Trunk
PowerPC
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

1.57 KB, text/html
Details
(Reporter)

Description

12 years ago
(Current Camino-trunk build, Mac OS X 10.3)

scrollWidth is returning wrong values for <pre>-elements, the returned value is the same as the offsetWidth. Safari gets this right.

Reproducible: Always

Steps to Reproduce:
1. Load testcase
2. Click the "Show sizes"-button
3. Compare the values to other browsers

This is similar to bug 209807 so cc'ing bz.
(Reporter)

Comment 1

12 years ago
Created attachment 231333 [details]
Testcase

The script and button is stolen from the testcases in bug 209807.
Er... So what _should_ scrollWidth return?  Note that the <pre> is not scrollable, so its scrollWidth _is_ the same as its offsetWidth, based on all the documentation I've seen.

This has nothing to do with <pre> elements, of course.  The relevant code is the same for all HTML elements: <http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/content/html/content/src/nsGenericHTMLElement.cpp&rev=1.663&mark=1158-1160#1147>.

I should note that in IE/Windows I see scrollWidth == offsetWidth on this testcase as well.  Of course the offsetWidth is different from that for Gecko, but that's due to an IE bug in CSS rendering.  Put borders on your <pre> to see the difference there.

It sounds like Safari is returning the same offsetWidth as Gecko but the same scrollWidth as IE on this testcase; that's incorrect behavior...
Status: UNCONFIRMED → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → INVALID
Component: DOM: Mozilla Extensions → DOM
Product: Core → Core
You need to log in before you can comment on or make changes to this bug.