Closed Bug 131029 Opened 22 years ago Closed 22 years ago

innerWidth is incorrect when a scrollbar is present

Categories

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

x86
Linux
defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 48634

People

(Reporter: itter, Assigned: jst)

References

Details

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020204
BuildID:    Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020204

When you grab the innerWidth in javascript, the value is correct, as long as you
don't have a scrollbar present. If the page is longer, and the scrollbar
appears, the innerWidth is still reported as the size of the entire browser.

I worked around it by comparing the document.body.offsetHeight to the
innerHeight to see if the scrollbar would be present, and changed the innerWidth
according to that.

Reproducible: Always
Steps to Reproduce:
1.Create a page that displays the innerWidth in javascript without scrollbars
2.Make the page longer so the scrollbar appears, innerWidth will be the same
value (this is wrong)


Expected Results:  It would make more sense for innerWidth to return the
available space (window size minus scrollbar width)
-> Dom0
Assignee: trudelle → jst
Component: XP Apps → DOM Level 0
QA Contact: paw → desale
Does IE have innerWidth?  If not, this is invalid, since innerWidth in NS4 does
not account for the scrollbar and we only have the property for NS4 compat.

You may want to just use document.body.offsetWidth.....
Just checked and IE does not support window.innerWidth...  so our behavior is
correct as far as NS4 compat goes.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
*** Bug 140308 has been marked as a duplicate of this bug. ***
reopen to mark as duplicate of bug 48634
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---

*** This bug has been marked as a duplicate of 48634 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago22 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.