diff --git a/Foundation/CPTimer.j b/Foundation/CPTimer.j index 6edfa4818..19cca083b 100644 --- a/Foundation/CPTimer.j +++ b/Foundation/CPTimer.j @@ -254,6 +254,9 @@ var _CPTimerBridgeTimer = function(codeOrFunction, aDelay, shouldRepeat, functio theFunction = function() { codeOrFunction.apply(window, functionArgs); if (!shouldRepeat) CPTimersForTimeoutIDs[timeoutID] = nil; } } + // A call such as setTimeout(f) is technically invalid but browsers seem to treat it as setTimeout(f, 0), so so will we. + aDelay = aDelay | 0.0; + CPTimersForTimeoutIDs[timeoutID] = [CPTimer scheduledTimerWithTimeInterval:aDelay / 1000 callback:theFunction repeats:shouldRepeat]; return timeoutID;