Open
Description
http://www.w3.org/TR/2011/WD-html5-20110525/timers.html#timers
When the above methods are to get the timeout, they must run the following steps:
- Let timeout be the second argument to the method, or zero if the argument was omitted.
- Apply the ToString() abstract operation to timeout, and let timeout be the result. [ECMA262]
3. Apply the ToNumber() abstract operation to timeout, and let timeout be the result. [ECMA262]- If timeout is an Infinity value, a Not-a-Number (NaN) value, or negative, let timeout be zero.
- Round timeout down to the nearest integer, and let timeout be the result.
- Return timeout.
So:
http://www.ecma-international.org/ecma-262/6.0/index.html#sec-tonumber
calls http://www.ecma-international.org/ecma-262/6.0/index.html#sec-toprimitive
which calls valueOf
Effectively: each data structure, primitive or object that abstract operation ToNumber can cast to a number should be a valid value of all options that now require number
Real life example: http://momentjs.com/docs/#/durations/
Duration implements valueOf
and it returns duration length as milliseconds.
CacheFactory triggers an error where it shouldn't when duration is passed - browser can handle that.
Metadata
Metadata
Assignees
Labels
No labels