prop vs attr

Benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<input id="foo" type="checkbox" name="foo"/>

Test runner

Ready to run.

Testing in
TestOps/sec
prop single
$('#foo').prop('disabled', true).prop('checked', true);
ready
attr single
$('#foo').attr('disabled', true).attr('checked', true);
ready
prop map
$('#foo').prop({disabled: true, checked: true})
ready
attr map
$('#foo').attr({disabled: true, checked: true})
ready

Revisions

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