$(this).attr('id') vs this.id (v22)

Revision 22 of this benchmark created by Dmitriy on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<a id="tester0" class="tests" href="#">abcdefghijkl</a>

<script>
  var a = document.getElementById('tester0')
    , $a = $(a)
    ;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
$a.attr('id')
$a.attr('id');
ready
a.id
a.id;
ready
$a.get(0)
$a.get(0).id;
ready

Revisions

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