我想用jQuery Lint检查可能的jQuery错误。jQuery Lint错误是相当不具描述性的
我想试用一个简单的脚本,它的工作原理。我把jquery lint包括在内,把它设置为2级,而BAM则有3个错误。
jQuery(.highlightimage) special check failed
jquery.lint.js (line 100)
More info:
Selector: .highlightimage Selectors should be as specific as possible and should be "class only"
Collection: []
Location:
@http://localhost:53402/Resources/Scripts/jquery-1.6.1.min.js:16
@http://localhost:53402/Resources/Scripts/highlights.js:15
@http://localhost:53402/Resources/Scripts/jquery-1.6.1.min.js:16
@http://localhost:53402/Resources/Scripts/jquery-1.6.1.min.js:16
什么?第15行是:
hl_elements = $(".highlightimage");
那个错误是什么意思?选择器包含5个元素,因此它是有效的。它尽可能具体。
它在$(document).ready(function(){/ 这里是脚本 /});部分。
我的所有选择器都是这样失败的。我究竟做错了什么?
我正在使用jquery 1.6.1,它可能还不支持,但在github上已经有jquery 1.6.1的测试用例,并且它们工作正常。
其他错误是:
trigger(ready) called incorrectly
jquery.lint.js (line 100)
More info:
Collection: [Document localhost:53402]
Location:
@http://localhost:53402/Resources/Scripts/jquery-1.6.1.min.js:16
jquery.lint.js (line 115)
You passed: ["ready"]
Available signatures include:
trigger(eventType, extraParameters)
trigger(event)
我得到的页面加载。
每当图像被改变时,我都会得到另一个。
jQuery.removeData([object HTMLImageElement],fxqueue,true) called incorrectly
jquery.lint.js (line 100)
More info:
Location:
@http://localhost:53402/Resources/Scripts/jquery-1.6.1.min.js:16
@http://localhost:53402/Resources/Scripts/jquery-1.6.1.min.js:18
@http://localhost:53402/Resources/Scripts/jquery-1.6.1.min.js:18
jquery.lint.js (line 115)
You passed: [img.highlightimage /Documen..._293.png, "fxqueue", true]
Available signatures include:
jQuery.removeData(element, [name])
但是,如果我切换到jquery 1.4.4这最后一个不会发生。
有时候立即上方或下方有一个错误,但我不能告诉你更多没有一些代码片段:) – 2011-06-08 08:46:36
http://jsfiddle.net/SoonDead/fMcrb/这是我的代码,我也使用jquery 1.6.1 – SoonDead 2011-06-08 12:35:35