Open
Bug 1068430
Opened 10 years ago
Updated 2 years ago
window.scroll to a number outside the signed 32-bit integer range has odd behavior
Categories
(Core :: DOM: Core & HTML, defect, P5)
Tracking
()
UNCONFIRMED
People
(Reporter: 7cc, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 6.0; rv:32.0) Gecko/20100101 Firefox/32.0
Build ID: 20140911151253
Steps to reproduce:
1. scroll to the bottom of a page
2. run window.scroll,
passing the second argument a number greater than (Math.pow(2, 31) - window.scrollMaxY + window.pageYOffset)
window.scroll(0, 2147483648 - window.scrollMaxY + window.pageYOffset)
Actual results:
It acts as if window.scroll(0, 0)
Expected results:
no scroll
window.scroll(2147483648 - window.scrollMaxX + window.pageXOffset, 0) behaves the same.
![]() |
||
Comment 2•10 years ago
|
||
This has nothing to do with pageYOffset.
What's going on is you're calling:
window.scroll(0, 2147483648)
and internally the arguments to window.scroll are coerced to a 32-bit integer. The result of this coercion is a negative number.
Summary: window.pageXOffset and window.pageYOffset affects window.scroll → window.scroll to a number outside the signed 32-bit integer range has odd behavior
This has to do with pageYOffset.
the code window.scroll(0, 2147483648 - window.scrollMaxY + window.pageYOffset)
- not at the bottom, scroll down
- only at the bottom, scroll up to the top
whereas window.scroll(0, 2147483648)
- always scroll up to the top
Anyway, yes, it is about a 32-bit integer.
ah... sorry, at first I tested scrollBy.
scrollBy(0, 2147483648 - window.scrollMaxY)
I now realized `scrollBy` calls `scroll` internally. plz ignore the comment 3. thanks.
Comment 5•7 years ago
|
||
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
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•