jQuery().prop vs jQuery().attr reading (v31)

Revision 31 of this benchmark created by Mike Frey on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<input id="el" value="stuff" />
<script>
  var i = 0,
      el = document.getElementById('el'),
      $el = $(el);
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery.fn.attr
$el.attr('id');
ready
jQuery.fn.prop
$el.prop('id');
ready

Revisions

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