Bug 92495 - Change HTMLInputElement::setValueAsNumber to throw NOT_SUPPORTED_ERR only when the given value is NaN
Summary: Change HTMLInputElement::setValueAsNumber to throw NOT_SUPPORTED_ERR only whe...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-27 05:20 PDT by Kwang Yul Seo
Modified: 2012-07-27 05:54 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kwang Yul Seo 2012-07-27 05:20:04 PDT
Currently, HTMLInputElement::setValueAsNumber throws NOT_SUPPORTED_ERR if newValue is infinity. This behavior is wrong because infinity is a valid number. Each input type additionally checks if the number is infinity or not. For example, NumberInputType::setValueAsDouble compares newValue to +floatMax and -floatMax and throws INVALID_STATE_ERR.

Changed HTMLInputElement::setValueAsNumber to check isnan(newValue) instead of !isfinite(newValue).
Comment 1 Kwang Yul Seo 2012-07-27 05:54:20 PDT
Oops. I found the following note from the HTML5 spec:

The Infinity and Not-a-Number (NaN) values are not valid floating-point numbers.