I think it is warranted, and I thought so a year ago
I realized quite some time ago that jQuery was gaining momentum and
would soon be one of the de-facto standards for Javascript
development. It's not perfect. It has some design flaws. Its internals
could use some cleaning up. But what general-purpose technology
doesn't?
HTML is seriously bastardized and has been abused for over a decade.
CSS is far from perfect and has some seriously questionable design
decisions. Javascript as a language itself has some drawbacks, quirks,
and missing features that would make life better. So here comes
jQuery, which is not perfect by any means, but is ridiculously useful
and has made interactive javascript more accessible to the mainstream.
The primary reason I balk at using jQuery or similar libraries is that
a great deal of the basic, cross-browser functionality required for a
specific job can be accomplished in very much less code. Other really
helpful bits like 'each' are pretty simple to do and seem prime
candidates to be added in the next version of ECMAScript. So much of
what libraries do is easily replaced using standard javascript that
anyone should be able to maintain, I don't need a jQuery (or Dojo or
Prototype.js) specialist.
I'm not a fan of highly active user interfaces - I really dislike
things that fade in and out or slide up and down or popup tool tips.
Therefore many of the animation and special effects are of no use to
me.
I'm in favor of it. And I'm in favor of improving it, because it is
quickly becoming a tool that is used by many people.
Some important points for me:
1) It works. I know it has some internal problems like browser
sniffing and code that isn't as accurate as it should be. But in every
case where I have decided to use it, it has worked and worked well in
most cases. Argue all you want about it being 1px off or slow or how
it _could_ work in browser X if it just didn't browser sniff... but in
reality, in many cases, it works and works well.
I would feel more comfortable with that if there was evidence that
such issues were being actively addressed, but there seems to be more
browser sniffing with each release (there are about 30 in v1.2.6).
Guess Nokia are hoping that the special stuff for "webkit" aka Safari
will suit its browser (there are about 10 sniffs specific to Safari,
some for specific version numbers).
2) It's supported. The discussion lists are very active and there is a
huge community around it. It's under constant development. Momentum is
in its favor. That's a good thing.
The volume of discussion on lists isn't much of an indication,
typically there is a large bubble at the beginning that tapers off.
Nor does it indicate the quality of response (in fact it can show the
reverse). A good percentage of posts don't get answered at all.
A better indication is the frequency of updates and bug fixes and the
availability of well-written books, articles and tutorials. I can't
comment on that, but the documentation on the jQuery web site leaves a
lot to be desired.
3) It encourages unobtrusive scripting. Sometimes too much, IMO. But
by its nature it encourages people to put classes on their HTML tags
and add the behavior after the page is ready. It doesn't encourage all
the best practices, but it's a step in the right direction.
Putting aside my dislike of the term "unobtrusive scripting", I don't
think it necessarily encourages it more than say putting scripts at
the bottom of the page.
Once you start attaching behaviour based on some form of general
selector (even something as simple as a home-grown
getElementsByClassname function), it’s hard to go back to in-line or
specific functions to do the job. I would argue that a lot of such
functionality can be similarly processed at the server and a simple in-
line listener added, but that’s for another discussion that would
likely end in “horses for courses”.
4) Plugins are questionable. The base jQuery library has a lot of
fundamentals, but if you want "controls" then you need to venture into
the plugin territory. And sometimes this is bad news. The quality of
the plugins is, generally, much lower than jQuery itself, IMO. Be
careful what you use. In some cases, I have been writing my own
because the ones that exist aren't good enough.
This is supposed to be a "for" list.
I think plugins are the major benefit for many users (i.e. web page
authors), anyone who is unconcerned about the issues of using jQuery
is likely not fussed by the issues of using poorly written plugins
(that is not to say all plugins are poorly written, just that users
don’t really care, just so long as “it works” in maybe 4 different
browsers where IE is two of them).
I don't think jQuery (or any general-purpose lib) is the right tool
for everyone. If you have the skill, time, and money to build all your
components from scratch, then go for it. For everyone else, I think
jQuery is the best possible route to go right now and the foreseeable
future.
If it replaces the massive bloat that comes with .NET by default, that
has to be a tick in its favour.