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 20496 - valueAsNumber's setter should be "double", not "unrestricted double". Or the prose needs to handle NaN/Infinity.
Summary: valueAsNumber's setter should be "double", not "unrestricted double". Or the ...
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-22 17:34 UTC by contributor
Modified: 2013-02-13 20:21 UTC (History)
4 users (show)

See Also:


Attachments

Description contributor 2012-12-22 17:34:33 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/
Multipage: http://www.whatwg.org/C#dom-input-valueasnumber
Complete: http://www.whatwg.org/c#dom-input-valueasnumber

Comment:
valueAsNumber's setter should be "double", not "unrestricted double". Or the
prose needs to handle NaN/Infinity.

Posted from: 76.102.14.57
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.101 Safari/537.11
Comment 1 Ian 'Hixie' Hickson 2012-12-22 17:35:58 UTC
heycam: Here's another example of wanting a different setter type than getter type. I want to return NaN sometimes (unrestricted double), but the setter needs to just be double.
Comment 2 Ian 'Hixie' Hickson 2012-12-22 17:38:13 UTC
Actually for NaN volkmar suggests that setting the value to "" might be more useful. (This is what Gecko does.) Still need to throw for Infinity, though.
Comment 3 Mounir Lamouri 2012-12-28 13:06:19 UTC
Gecko/Firefox 20 implements the following behaviour:
- |.valueAsNumber = NaN;| will set the value to the empty string (ie. equivalent to |.value = "";|.
- |.valueAsNumber = Infinity;| (or -Infinity) will throw without changing the value. Not that for the moment, Gecko doesn't throw TypeError for internal reasons. This will happen later.

This change should be soon (max 24 hours) available in a Nightly build. To test it on a Desktop version of Firefox, you have to enable the following pref in about:config: "dom.experimental_forms". The pref is enabled by default on Firefox Mobile.

More information about the change:
https://bugzilla.mozilla.org/show_bug.cgi?id=825009
Comment 4 contributor 2013-02-13 20:21:27 UTC
Checked in as WHATWG revision r7723.
Check-in comment: Define setting valueAsNumber to Infinity or NaN.
http://html5.org/tools/web-apps-tracker?from=7722&to=7723