我正在开发一个jQuery插件,但是我遇到了JSLint错误:
Problem at line 80 character 45: Do not use 'new' for side effects.
(new jQuery.fasterTrim(this, options));
我在搜索JSLint错误或者关于使用new
可能产生的副作用方面没有什么好运气。
我尝试通过谷歌搜索“不要将'new'用于副作用”,但是没有结果。 必应给了我2个结果,但它们都只是引用JSLint源代码。希望这个问题能改变这种情况。 :-)
更新#1: 下面是更多的上下文来源:
jQuery.fn.fasterTrim = function(options) {
return this.each(function() {
(new jQuery.fasterTrim(this, options));
});
};
更新 #2: 我使用Starter jQuery插件生成器作为我的插件模板,其中包含了该代码。