为什么JSHint会抛出“可能的严格违规行为”?在这条线上 [英] Why is JSHint throwing a "possible strict violation" on this line

查看:65
本文介绍了为什么JSHint会抛出“可能的严格违规行为”?在这条线上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在JsHint中验证一些Javascript,我得到以下内容:

Trying to validate some Javascript in JsHint, and I get the following:

可能的严格违规行为:

return ($.event.dispatch || $.event.handle).apply(this, args);

为什么会抛出这个错误?

Any ideas why it's throwing that error?

谢谢你们

推荐答案

JSHint不确定代码所在的函数是否会被实际的<$ c调用$ c> this 。

JSHint isn't sure whether the function that code is in will be called with an actual this.

要告诉JSHint如何调用该函数并禁止显示此警告,请添加 / * jshint validthis:true * / 到函数的顶部。

To tell JSHint how the function will be called and suppress this warning, add /*jshint validthis: true */ to the top of the function.

这篇关于为什么JSHint会抛出“可能的严格违规行为”?在这条线上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆