Useless setTimeout call (missing quotes around argument?)

让人想犯罪 __ 提交于 2019-12-03 10:57:35

There already exists a jQuery-method delay and it expects a string(queueName) and not a function as parameter. Choose another name for your delay-method to avoid conflicts.

I got same error when I wrote

setTimeout(updateStatus(), 5000);

instead of

setTimeout(updateStatus, 5000);

I agree with wsbaser. I had the additional instance of needed to pass information to the function, and for simplicity used:

setTimeout(function(){ updateStatus(myData) } , 5000);

The argument needs to be a function and not a function being called. Firefox caught this error, chrome let it go.

Just for reference if someone stumbles upon this question and is looking for a possible answer. I got the exact same error message as the initial poster because I was mixing up the setTimeout arguments order.

This:

setTimeout(25, function(){
    spotlight.intro.find('#intro').ellipsis();  
});

... gave me the error message. I changed the function to this:

setTimeout(function(){
    spotlight.intro.find('#intro').ellipsis();
}, 25);

And my problem was solved.

The problem was in Firefox 3. It is not handling some elements properly => Element is completely omitted in the tree and ignored -> hence my original problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!