如何在IE8中检测参数对象?

4

1
IE 8不支持“严格模式”,因此检查callee应该可以工作。 - gen_Eric
1
就像@Rocket所说的那样。你只需要短路.callee测试,因为在严格模式下会抛出异常。 return Object.prototype.toString.call(item)=== '[object Arguments]' || !! item.callee; - cliffs of insanity
1个回答

4

请注意,对于 isArguments({callee: true}) 等情况,所有浏览器都会返回 true - Roman Pominov
看看它在下划线中是如何修复的:https://github.com/jashkenas/underscore/blob/4c534babce217abb7e13bd47efcb399e47ef9cca/underscore.js#L1234-1247 - Roman Pominov

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接