argument.callee问题
今天写了段js代码,然后用jshint测试了下,提示了一个建议: avoid arguments.callee
具体代码我是这么写的:
...
(function (){
$(this).animate({"marginTop":"35px","opacity":0.7},800)
.delay(400)
.animate({"marginTop":"5px","opacity":1},800);
$(this).queue(arguments.callee); //再入队列
$(this).dequeue();
})
arguments.callee -- This property is deprecated by ECMA-262 in favor of named function expressions and for better performance.
解决方法很简单
function handle(){
...
//avoid arguments.callee
//$(this).queue(arguments.callee); //再入队列
$(this).queue(handle); //use the function name
...
}
stackoverflow有篇文章说这个:
有兴趣可以了解下为什么少用argument.callee??