Yesterday, after seeing this thread, I started work on a "jQuery Lint"
script. You can see it here: http://github.com/jamespadolsey/jQuery-Lint
It does a few basic checks - argument signatures being the main one.
It also tries to combat lack-of-caching with selections, and it will
warn you when your selection returns nothing. It'll also suggest that
you use attr({...})/css({...} instead of css().css().css().css() ...
I've added a simple API via which you can add special checks. For
example:
jQuery.LINT.special[1].jQuery = function(selector, context) {
if (selector === '*') {return "Don't use the universal
selector!"; }
// Everything is fine... don't return anything (or return true)
};
So, potentially, one of you could create a bunch of these "special
checks" and release them all as a separate script which can be slotted
in with Lint.
It's been made to work with Firebug, but you can quite easily slot in
your own console mechanism via jQuery.LINT.console.
Like I said, this was started yesterday, so it's still got a few
kinks...
On Jan 15, 7:53 pm, Matt <[email protected]> wrote:
> On Jan 15, 1:11 pm, Scott Sauyet <[email protected]> wrote:
>
> > I like the idea, and I think it would be possible to do this as a
> > plug-in, which replaces calls to jQuery functions with calls that
> > check the parameters, store errors, then delegate to the the original
> > function. But have no time at the moment to help implement it.
>
> Check the archives. This comes up every few months, everyone agrees it
> would be cool, everyone agrees it could be implemented relatively
> easily, yet no one wants to spend the time to build, test, and release
> it. Bummer.
>
> Matt Kruse
--
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en.