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

Revision 26 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/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/prototype/1/prototype.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.3/mootools-yui-compressed.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/yui/2.9.0/build/yuiloader/yuiloader-min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/dojo/1/dojo/dojo.xd.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/ext-core/3/ext-core.js"></script>
<script src="https://www.cinsoft.net/mylib099-min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

<input type="checkbox" value="y" name="my-test-checkbox" id="my-test-checkbox" checked>
<script>
  var $el = $('#my-test-checkbox');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
.prop()
// async test
$el.prop('checked');
ready
.is(':checked')
$el.is(':checked');
ready
attr("checked")
$el.attr("checked");
ready
.checked
$el[0].checked;
ready

Revisions

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