swsieber 9 hours ago

I think it's still the case. The 4ms happens if you call setTimeout nested several times. I don't know the exact limit. But it's 5-ish times where that kicks in IIRC.

Edit: Here's the MDN bit on that, I was correct:

https://developer.mozilla.org/en-US/docs/Web/API/Window/setT...

> browsers will enforce a minimum timeout of 4 milliseconds once a nested call to setTimeout has been scheduled 5 times.

And the link from there to the spec about that:

https://html.spec.whatwg.org/multipage/timers-and-user-promp...

> If nesting level is greater than 5, and timeout is less than 4, then set timeout to 4.

timhh 9 hours ago

I think that change is talking about the minimum timeout for the first 5 nested calls to `setTimeout(0)`.

Previously the first 5 would take 1ms, and then the rest would take 4ms. After that change the first 5 take 0ms and the rest take 4ms.