jQuery sucks ass man
<a href="#" onclick="popup()">Annoy me!</a>
Here’s a real life example.
One day, a Real Programmer came into the world of web developers. And he spake thus:
Thou shalt not allow the mixing of content and behaviour. Thou shalt write semantic HTML. Above all, thou shalt avoid code duplication, lest a plague of locusts be cast upon your land!
The web developers were given two years to adopt web standards. And adopt them they did. By the end of those two years, there was a new world-wide web.
getElementById more than twice a day, but some developers were writing it ten or twenty times before lunch! Something had to give.
Out of the shadows came a man by the name of Resig. This Resig man saw
getElementById and saw that it was bad. He saw CSS selectors and was impressed by their succinct clarity. And he said:
:nth-child should be able to select their elements with CSS selectors!
and jQuery was born.
Back to the truth, back to reality
Why jQuery? Why not another library?
Yes, I knew you’d ask that. Well, here’s my rationale. jQuery won. That’s it. jQuery has a huge community, with a lot of experts. More and more are moving to jQuery every day. Even in Rails, where for ages Prototype was bundled by default, there’s been a huge push towards using jQuery. I’m not saying it’s the best. But it’s got the best support. And it’s probably going to be the most developed for the foreseeable future.
- Part 1: Anonymous functions
- Part 2: Object literals
- Part 3: Evented programming model
- Part 4: Closures