Closed
Bug 1090938
Opened 10 years ago
Closed 10 years ago
window.clientWidth and element.clientWidth wrong on device-width viewport
Categories
(Firefox for Android Graveyard :: Toolbar, defect)
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1071620
People
(Reporter: nikosverschore, Unassigned)
References
Details
Attachments
(3 files)
When using the dimensions of the window and the elements, I noticed the elements are wrongfully calculated. This happens for all elements that are given a percentage width. Also the window.innerWidth is switching between the correct value and an incorrect value. This appears to be a problem with the viewport "width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0". Because all values are calculated as if the page was zoomed out. window.innerWidth: Jumps between 360 (the proper value) and 980 (the value when the viewport isn't defined and is zoomed out) document.body.clientWidth: Always 980, but shouldbox be 360 because the body isn't stretched. document.getElementById("fullBox").clientWidth: This is an element that is defined as 95% of the body. This return 931px, while it should give 342px Steps to reproduce: 1. Open testcase in LG Nexus 5 with FF33 Expected result: - window width: 360 - body width: 360 - fullBox width: 342 Actual result: - window width: 360 or 980 (sometimes the first, sometimes the last - body width: 980 - fullBox width: 931 You can visually see the problem in attached screenshots. After multiple refreshed, you either see the first or the second screenshot. In the meantime nothing has changed. In the testcase you see a 95%x95% box with a red border and a red marker that is placed on x:350px,y:500px. Visually you see that the red box does not stretch beyond the marker, but if you get the width of the border, it is 931px. So definitely wrong.
Comment 3•10 years ago
|
||
This likely has the same underlying problem as bug 1071620. As a workaround, if you read these properties after the load event you should always get the correct value, I think.
Depends on: 1071620
Okey, after further investigation this is indeed duplicate.
Comment 5•10 years ago
|
||
Ok. Thanks for the detailed test cases though!
Updated•3 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•