title: Surprisingly slow class selector in jQuery compared to 'getElementsByClassName' + Benchmarks
body: <p>I'm writing some tests for a CMS, and I need to know if a certain classname is in the document.</p>
  
  <p>So I went to investigate what is the fastest way to check if a classname exists in the document. You can see my benchmarks here: <a href="http://jsperf.com/if-class-exists" rel="nofollow">http://jsperf.com/if-class-exists</a></p>
  
  <p>If you run the test, you'll see 'getElementsByClassName' is by far the fastest(99%). This made me wonder if jQuery even checks if there is a native class selector available.</p>
  
  <p>This leaves me wondering what is the best approach, as it is crucial for me to test classnames really fast.</p>