[Bug 15379] Hi, i was wondering why there is explicit hard limit of how setTimeout works. In spec it says: 6.3 Timers ... "4. If the currently running task is a task that was created by the setTimeout() method, and timeout is less than 4, then increase timeout to 4."

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

Boris Zbarsky <bzbarsky@mit.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bzbarsky@mit.edu

--- Comment #1 from Boris Zbarsky <bzbarsky@mit.edu> 2012-01-02 05:26:00 UTC ---
Chrome actually tried to put the timeout clamp at 1ms initially.  They
discovered that this was not web-compatible and broke sites, which is why they
raised it to 10.

I can confirm that Opera's clamp seems to be lower, though.  On this testcase:

  var t = 0;
  var start = new Date;
  function f() {
    if (++t == 1000) {
      alert(new Date - start);
    } else {
      setTimeout(f, 1);
    }
  }
  setTimeout(f, 1);

I get numbers on the order of 1300 alerted in Opera (and same thing with
smaller timeout values)...

On the other hand, if I pass 0 for the timeout, Opera clamps it to 4ms, so it
has a weird discontinuous behavior subject to floating-point rounding errors
which may not be all that desirable either.

-- 
Configure bugmail: https://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, 2 January 2012 05:26:02 UTC