Open Bug 343143 Opened 18 years ago Updated 2 years ago

wrong value of input.scrollWidth

Categories

(Core :: DOM: CSS Object Model, defect, P5)

defect

Tracking

()

People

(Reporter: zdila, Unassigned)

References

(Depends on 1 open bug)

Details

(Whiteboard: [cssom-view])

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (compatible; Konqueror/3.5; Linux 2.6.15; X11) KHTML/3.5.2 (like Gecko) (Debian package 4:3.5.2-2+b1)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4

HTML:
<input id="inp" type="text" value="some a bit longer text to demonstrate the bug" />

ECMAScript:
document.getElementById("inp").scrollWidth

Problem description:
scrollWidth doesn't return width of the text inside input. It returs the same value as offsetWidth even if text doesnt fit the space of input field.

In MS Internet Explorer it works correctly.

BTW, isn't that the same as bug 209807?

Reproducible: Always

Actual Results:  
scrollWidth ignores width of the input's content

Expected Results:  
scrollWidth shold be equal to input's content width
Assignee: nobody → general
Component: General → DOM: Mozilla Extensions
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → Trunk
scrollWidth would only apply to a scrollable object, and the text input itself is not scrollable...

We could try to hack something together here for IE compat, but I'm not sure it's worth it.
Note also bug 293186 
Depends on: 293186
Martin: How is this value useful? I.e. what would you use the value for if it was available?

Boris: Is there some other way for the user to get this value?
Not really, no.
I needed this to resize width of the input field to the size of this content with JS.
Confirming, but maybe we want a different API here for getting that information...
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: general → nobody
QA Contact: ian → general
I'm having same problem with scrollWidth in FireFox (3.5.7), while in IE7 this works fine - returns scrollWidth values correctly.
Blocks: 536706
No longer blocks: 536706
Bug 536706 comment 0 might provide useful information on why this happens and how to fix it.
Component: DOM: Mozilla Extensions → DOM: CSS Object Model
QA Contact: general → style-system
Whiteboard: [cssom-view]
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: