I'm going thru some legacy code and I've noticed the following line(s):
// Stray timeout
var t = setTimeout('',1);
Does it do anything? Is it really required?
There is a following question on SO: Why is setTimeout(fn, 0) sometimes useful?
The solution is to "pause" the JavaScript execution to let the rendering threads catch up. And this is the effect that setTimeout() with a timeout of 0 does. It is like a thread/process yield in C. Although it seems to say "run this immediately" it actually gives the browser a chance to finish doing some none-JavaScript things that have been waiting to finish before attending to this new piece of JavaScript.
That explains benefits of executing a function in setTimeout. But how about executing an empty string?