Is sometimes funny to see how fast things evolves in the web development world.

If you do a quick search in google about jQuery performance, you will easily find articles talking about the advantages of using tag selectors before classes and the recommendation of avoiding class selectors as possible.

Performance jquery selectors

To name some of those pages I found about the topic:

  • http://www.artzstudio.com/2009/04/jquery-performance-rules/#use-tags-before-classes
  • http://www.thewebsqueeze.com/web-design-tutorials/improve-your-jquery-selectors-5-quick-tips.html
  • http://stackoverflow.com/questions/46214/good-ways-to-improve-jquery-selector-performance/46253#46253

Everything sounds very coherent until you look at the posting date of those comments: 3 or 4 years ago.

It doesn’t sound that much right? Well, then we should remember that we are working on Internet and things here live in another time dimension.

The new jQuery performance tips

If you perform a test today with the advises of those antique links I posted previously, you will easily realize that things are not like that anymore.

You can take a look at this test or create your own simplified version to see with your own eyes the new reality.

Yes my friends, nowadays browsers implement getElementsByClassName and old advises are unuseful this respect.

Now you know, keep up to date your knowledge guys! :)