W3C home > Mailing lists > Public > public-html-bugzilla@w3.org > May 2011

[Bug 11887] Remove useless input.valueAsNumber. Pretty much the same functionality can be achieved using parseFloat or parseInt

From: <bugzilla@jessica.w3.org>
Date: Mon, 09 May 2011 21:49:04 +0000
To: public-html-bugzilla@w3.org
Message-Id: <E1QJYK8-00064s-GP@jessica.w3.org>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=11887

--- Comment #14 from Ian 'Hixie' Hickson <ian@hixie.ch> 2011-05-09 21:49:03 UTC ---
Came across an interesting example of the convenience for this recently:
changing the value of a range control by a certain known delta:

   input.valueAsNumber += delta;

The alternatives are a bit of a pain:

   input.value = parseFloat(input.value) + delta;

   if (delta > 0)
     input.stepUp(delta/parseFloat(input.step));
   else
     input.stepDown(delta/parseFloat(input.step));

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Monday, 9 May 2011 21:49:06 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 16:31:10 UTC