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

Revision 37 of this benchmark created on


Preparation HTML

<script src="//code.jquery.com/jquery-2.0.3.min.js"></script>

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

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

Test runner

Ready to run.

Testing in
TestOps/sec
$a.attr('id') === 'tester0'
$a.attr('id') === 'tester0';
ready
$a.is('#tester0')
$a.is('#tester0');
ready
a.id === 'tester0'
$a[0].id === 'tester0';
ready

Revisions

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