jQuery attr() vs. Native setAttribute() (v20)

Revision 20 of this benchmark created by beep on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script type="text/javascript">
var el, $el;
$(document).ready(function() {
  el = document.getElementById('btn');
  $el = $(el);
});
</script>
<input type="text" id="btn"></div>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery attr()
$el.attr("disabled", "disabled");
ready
Native setAttribute()
el.setAttribute("disabled", "disabled");
ready

Revisions

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