Just after a bit of advice on something that’s been bugging me for a while. Is it better for performance to use option 1 or option 2? Or does it not matter at all?
$('.class').removeClass("class");$('*').removeClass("class");
The reason I ask is because I use this code (or similar) quite often and I’m starting to try an optimise my code as much as possible. Both of them work, but which is better?
There is a website named jsperf.com where you can post javascript tests. You create many many code snippets, a website that it can test your snippets on and it will tell you, which snippet is the fastest.
I have prepared a test for you, just install Java and run the tests. Option 1 is better 🙂
http://jsperf.com/select-speed