我正在为 jQuery 开发一个插件,我收到了这个JSLint错误:
Problem at line 80 character 45: Do not use 'new' for side effects.
(new jQuery.fasterTrim(this, options));
我没有太多运气找到有关此 JSLint 错误或任何new
可能产生的副作用的信息。
我试过用谷歌搜索“不要使用‘新的’来获得副作用。” 并得到 0 个结果。Binging给了我 2 个结果,但它们都只是引用了 JSLint 源。希望这个问题会改变这一点。:-)
更新#1: 这里有更多的上下文来源:
jQuery.fn.fasterTrim = function(options) {
return this.each(function() {
(new jQuery.fasterTrim(this, options));
});
};
更新 #2: 我使用Starter jQuery 插件生成器作为我的插件的模板,其中包含该代码。