Closed Bug 346591 Opened 18 years ago Closed 18 years ago

scrollWidth wrong for <pre>-elements

Categories

(Core :: DOM: Core & HTML, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: torben, Unassigned)

Details

Attachments

(1 file)

(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.
Attached file 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
Closed: 18 years ago
Resolution: --- → INVALID
Component: DOM: Mozilla Extensions → DOM
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: