-
Notifications
You must be signed in to change notification settings - Fork 38
Error reports
jamespadolsey edited this page Sep 13, 2010
·
8 revisions
The misuse-reporting level can be set to anywhere between zero (everything off) to three (everything on), via jQuery.LINT.level
.
- Nothing.
- Incorrect argument signatures. The correct argument signatures are defined by the API — jQuery Lint includes a skinny version of the API which it references to determine whether or not you’re passing the correct arguments.
- Errors thrown by calls to jQuery methods — usually as a result of incorrect argument signatures.
- Everything above.
- Using the same selector twice, and the returned collection being the same both times. If you use the same selector more than once, and the returned collection is the same both times then you should probably be caching the first selection, instead of making subsequent identical selections.
- Using selectors that don’t return anything. jQuery operates fine with empty collections, but Lint will still bring up a warning if this happens.
- Trying to access
jQuery.browser
(you should be using feature detection), and trying to accessjQuery.browser.safari
, specifically — it’s deprecated. Also, accessingjQuery.boxModel
instead ofjQuery.support.boxModel
raises a similar error. (note: these only bring up errors if you’re using a browser that supports__defineGetter__
, like Firefox!) - Using
:
filters that don’t exist injQuery.expr[':']
. E.g.jQuery('a:hover')
- Using
jQuery().ready(function(){})
instead of the properjQuery(document).ready(function(){})
orjQuery(function(){})
.
- Everything above.
- Not taking advantage of combined property definitions, via
css({...})
orattr({...})
or evenbind({...})
(in 1.4).
You can add your own custom checks too, via jQuery Lint’s API.