jQuery prop('checked') vs. is(':checked') (v69)

Revision 69 of this benchmark created on


Description

A quick test to see if prop('checked') or is(':checked') is faster with jQuery.

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

<input type="checkbox" value="y" name="my-test-checkbox1" id="my-test-checkbox1" class="zz" >

<script>
  var $el = $('#my-test-checkbox1');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
.prop()
$el.prop('checked', true);
ready
attr("checked", true)
$el.attr("checked", true);
ready
.checked
$el[0].checked = true;
ready

Revisions

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