No, it won't run; it will be queued and then subsequently aborted. The specificiation goes through a number of steps when you call setTimeout
, one of which (after the minimum timeout, plus and user-agent padded timeouts etc) is eventually:
- Queue the task task.
This appears to happen regardless of whether or not the handle that was returned in step 10 has been cleared - ie a call to setTimeout
will always result in something being enqueued.
When you call clearTimeout
, it:
must clear the entry identified as handle from the list of active timers
ie it doesn't directly affect the process already kicked off in the call to setTimeout
. Note however that further up that process, task has been defined as:
Let task be a task that runs the following substeps:
- If the entry for handle in the list of active timers has been cleared, then abort this task's substeps.
So when the task begins executing, it will first check if the handle has been cleared.