[Bug 28875] [EnforceRange] accepts an odd set of input values

https://www.w3.org/Bugs/Public/show_bug.cgi?id=28875

Jeffrey Yasskin <jyasskin@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sleevi@google.com

--- Comment #2 from Jeffrey Yasskin <jyasskin@gmail.com> ---
Thanks for finding the extra uses.

We're excluding some non-integral arguments, but not a consistent set. (That's
similar to a lot of Javascript, so maybe it's ok; I'm just checking that it's
intentional.)

If we want to exclude "strange" input values without breaking "123", I think
the appropriate algorithm is something like:

1. Initialize p to ToPrimitive(V, hint Number).
2. If p is "" or null, throw a TypeError.  // Excludes empty arrays.
3. Initialize x to ToNumber(p).
4. If x is NaN, +∞, or −∞, then throw a TypeError.
5. Set x to sign(x) * floor(abs(x)).
6. If x < 0 or x > 2^32 − 1, then throw a TypeError.
7. Return the IDL unsigned long value that represents the same numeric value as
x.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Wednesday, 1 July 2015 21:09:07 UTC