jquery attr(class vs className)

Benchmark created on


Preparation HTML

<div id="test" class="box">this is some stuff it says in the test div.</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
  var $test = $('#test'),
      a = null,
      b = null;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
jquery attr(class)
a = $test.attr('class');
ready
jquery attr(className)
b = $test.attr('className');
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.