我想用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