Typical jQuery over-use:
$('button').click(function() {
alert('Button clicked: ' + $(this).attr('id'));
});
Which can be simplified to:
$('button').click(function() {
alert('Button clicked: ' + this.id);
});
Which is way faster.
Can you give me any more examples of similar jQuery over-use?
IMHO, these aren’t things to worry about.
The $ function is incredibly fast, and guarantees cross-browser problems are not going to be a problem. For example, that might work fine right now, but what happens if IE9 comes out and breaks it? If you’re using the $ function everywhere, then a fix in one place fixes it everywhere. Not to mention, I can’t imagine a case where this would get you any sort of performance increase.
Therefore, unless you’re having issues with performance, don’t worry about micro-optimizations. jQuery 1.4 had some huge performance increases anyway, so unless you’re doing:
all over the place without caching, you’re not going to get any return on your time investment.