Bug 15099 - self.innerWidth is not reported correctly.
Summary: self.innerWidth is not reported correctly.
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 523.x (Safari 3)
Hardware: Mac (Intel) OS X 10.4
: P3 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-27 19:12 PDT by Vincent Lee
Modified: 2022-07-12 11:26 PDT (History)
3 users (show)

See Also:


Attachments
HTML file for testing self.innerWidth (5.72 KB, text/html)
2007-08-27 19:13 PDT, Vincent Lee
no flags Details
reduced test case (4.32 KB, text/html)
2007-08-28 06:08 PDT, Alexey Proskuryakov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vincent Lee 2007-08-27 19:12:07 PDT
PROBLEM:
In Webkit nightly build 25261, self.innerWidth is reporting the whole width, including vertical scrollbar's width.

METHOD:
Call "self.innerWidth" at body onload handler.

RESULT:
"self.innerWidth" currently reports the whole application window width.

EXPECTED:
"self.innerWidth" should report a width value that is the difference of application window width and the vertical scrollbar.

WORKAROUND:
None.
Comment 1 Vincent Lee 2007-08-27 19:13:58 PDT
Created attachment 16140 [details]
HTML file for testing self.innerWidth

Please use this HTML file to reproduce this issue.
Comment 2 Alexey Proskuryakov 2007-08-28 06:08:34 PDT
Created attachment 16142 [details]
reduced test case

This new test case only checks innerWidth, omitting browser-specific workarounds that used scrollWidth and clientWidth.

In WebKit nightlies, innerWidth appears to behave the same way it does in Firefox (IE doesn't support this property). So, this seems to have been a legitimate bug fix, and the new behavior is correct.
Comment 3 Vincent Lee 2007-08-28 10:06:53 PDT
I like to point out that in the Rhino book (p.913 the "innerHeight, innerWidth" section) it suggests that "these dimensions do not include the size of the menubar, toolbars, scrollbars, and so on.". In the reduced test case, self.innerWidth returns 800 which is actually the whole window width including the vertical scrollbar width. On the other hand, self.innerHeight when tested w/ Webkit's nightly build r25261 reports the correct value that excludes the menubar, toolbars & the horizontal scrollbar. Since these values are reported inconsistently, resulting effect is positioning issues for different ajax framework elements that use these values.
Comment 4 Alexey Proskuryakov 2007-08-28 10:50:52 PDT
See bug 15061 for innerHeight. For us, interoperability with other browsers is usually more important than logical consistency, as it's the former that directly affects user experience. See <http://webkit.org/projects/goals.html>.

I'm not closing this issue yet, as someone more familiar with these historic problems may provide better insight.
Comment 5 Alexey Proskuryakov 2007-08-28 10:52:50 PDT
(In reply to comment #4)
> See bug 15061 for innerHeight.

Oops, sorry, that's not related.
Comment 6 Chris Brichford 2007-09-24 14:54:24 PDT
FireFox on windows seems to not include the width of the scroll bars in the innerWidth value.  However it does on mac.  Latest mac webkit nightly (r25708) as of this writing does what mac firefox does.  Did not test windows webkit.
Comment 7 Vincent Lee 2007-10-16 15:46:53 PDT
It seems the workaround is to use "document.body.clientWidth" and "document.body.clientHeight". The width of vertical/horizontal scrollbars are correctly excluded in their values; and this is the case for the latest Webkit nightly and Firefox (below). Are they replacements for "self.innerWidth" and "self.innerHeight"? If they're, then this bug is no longer valid and can be closed.

- Mac Webkit nightly (r26653)
- Windows Webkit nightly (r26595)
- Mac Gecko/20070914 Firefox/2.0.0.7
- Windows Gecko/20070914 Firefox/2.0.0.7
Comment 8 Brent Fulgham 2022-07-12 11:26:34 PDT
This appears to work properly in Safari 15. Could you please provide further details if you believe there is an ongoing problem?