This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 20640 - checking for infinity and nan values in window.scroll
Summary: checking for infinity and nan values in window.scroll
Status: RESOLVED FIXED
Alias: None
Product: CSS
Classification: Unclassified
Component: CSSOM View (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Simon Pieters
QA Contact: public-css-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-11 02:46 UTC by svitlant
Modified: 2013-08-08 13:28 UTC (History)
1 user (show)

See Also:


Attachments

Description svitlant 2013-01-11 02:46:29 UTC
Hello,

Step 1 of window.scroll algorithm (http://www.w3.org/TR/cssom-view/#dom-window-scroll) is to check whether the coordinates x and y are infinite or nan. However, the signature of the scroll method indicates that the type of those variables is "long", making infinite and nan values impossible.

Is it possible that the original intention was to make the coordinate values float or double? Otherwise, should this step exist at all?

The survey of the major browsers shows that this step is ignored (tested IE9, Chrome, Firefox).

Thanks,
Svitlana
Comment 1 Simon Pieters 2013-04-23 10:44:25 UTC
(In reply to comment #0)
> Hello,
> 
> Step 1 of window.scroll algorithm
> (http://www.w3.org/TR/cssom-view/#dom-window-scroll) is to check whether the
> coordinates x and y are infinite or nan. However, the signature of the
> scroll method indicates that the type of those variables is "long", making
> infinite and nan values impossible.

I think that step predated WebIDL throwing for those values. Fixed:

https://dvcs.w3.org/hg/csswg/rev/9b737ecc8598
https://dvcs.w3.org/hg/csswg/rev/d1dbf4fde303

> Is it possible that the original intention was to make the coordinate values
> float or double? Otherwise, should this step exist at all?

float and double also disallow NaN/infinity per WebIDL.

> The survey of the major browsers shows that this step is ignored (tested
> IE9, Chrome, Firefox).

Opera implements this step. Firefox/Chrome/IE9 seem to treat NaN/-Infinity/Infinity as 0. I'd like to see if throwing TypeError instead is Web-compatible before using "unrestricted long" in the spec.